Thursday, September 27, 2018

Field values retrieved in an after submit function are returned as'To Be Generated'.


nlapiGetNewRecord() will always return the values that were submitted (even during an afterSubmit). You would need to use nlapiLookupField, nlpiSearchRecord or nlapiLoadRecord in order to get the latest values.
 

For example, using nlapiLookupField:

function afterSubmit()
{
   var currentRecord = nlapiGetNewRecord();
   var recInternalId = currentRecord.getId();
   var tranNumber = nlapiLookupField('salesorder', recInternalId , 'tranid');
}

In the above, 'tranNumber' would properly store the tranid of the record.
Notes: Field values retrieved in an after submit function are returned as 'To Be Generated'.

For example:

function afterSubmit()
{
   var tranRecord = nlapiGetNewRecord();
   var id = tranRecord.getFieldValue('tranid');
}

In the above, 'id' would store 'To Be Generated'.


No comments:

Post a Comment