Hi All, I'm dipping my toes into 2.0 scripting, I ...
# suitescript
r
Hi All, I'm dipping my toes into 2.0 scripting, I have a SLET with a connected CS script. There is a button on the SLET which calls function on the CS. so far so good. But In 1.0 i would to a simple nlapiGetFieldValue to fetch values from the SLET into the CS file. I have tired
form.addButton({id: 'getLinesButton', label: 'Fetch Lines', functionName : 'getOrderLines'});
Copy code
define(['N/url'], function(url) {
function getOrderLines(scriptContext) {

    var vendor = scriptContext.currentRecord.getValue({ fieldId: 'custpage_vendor' });
    // var vendor = nlapiGetFieldValue('custpage_vendor');
    alert('getOrderLines' + vendor);
  }
return {
    pageInit: pageInit,
    getOrderLines: getOrderLines
  };

});
- First is this the correct way to fetch values, if so i'm sure i'm missing some small step cos i'm currently getting a error
Uncaught TypeError: Cannot read property 'currentRecord' of undefined
Thanks in advance...