Tuesday, September 25, 2018

Identify the Record Type of the Transaction by just referencing the 'Created From' field

Create a script that would look up the transaction type of the record indicated in the 'Created From' field. For Testing purposes, this can be deployed on the Before Load function of the Credit Memo record. This can also be applied to all records that has the "Created From" field.
Sample code below:

function getType(type)

  
   var createdFrom = nlapiGetFieldValue('createdfrom');
     if (createdFrom  != null && createdFrom  != '' ) 
     { 
          var createdFromType = nlapiLookupField('transaction', createdFrom, 'type'); 
          nlapiLogExecution('Debug','Transaction','Type : ' + createdFromType); 
     }
}

No comments:

Post a Comment