Advertisement
borncorp

Answer to Yamini Surender's Question

Feb 17th, 2017
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //########## CLIENTSCRIPT ##########
  2.  
  3. var CURRENTRECORDMODULE;
  4. define(['N/currentRecord'], runClientscript);
  5.        
  6. function runClientscript(currentRecord){
  7.     CURRENTRECORDMODULE = currentRecord;
  8.    
  9.     //*********** HELPER FUNCTIONS ***********
  10.     function create_amort_schedule() {
  11.         var currentRec = CURRENTRECORDMODULE.get();
  12.         var v_loan_pymt_mthd = currentRec.getValue({
  13.             fieldId:'custrecordpfg_adv_loan_pymt_type'
  14.         });
  15.         alert(v_loan_pymt_mthd);
  16.         return;
  17.     }
  18.    
  19.     var returnObj = {};
  20.     returnObj.create_amort_schedule = create_amort_schedule;
  21.     return returnObj;
  22. }
  23.  
  24. //########## USEREVENT ##########
  25. var WIDGETMODULE;
  26. /**
  27.  *@NApiVersion 2.x
  28.  *@NModuleScope Public
  29.  *@NScriptType UserEventScript
  30.  */
  31. define(['N/ui/serverWidget'], runUserEvent);
  32.  
  33. function runUserEvent(widget) {
  34.     WIDGETMODULE = widget;
  35.  
  36.     var returnObj = {};
  37.     returnObj.beforeLoad = beforeLoad;
  38.     return returnObj;
  39. }
  40.  
  41. function beforeLoad(context) {  
  42.     if (context.type == context.UserEventType.VIEW) {
  43.       context.form.addButton({
  44.         id : 'custpage_some_button',
  45.         label : 'Schedule',
  46.         functionName : 'create_amort_schedule'
  47.       });
  48.     }
  49.     return;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement