I want to get the tranid for an invoice as soon as the invoice has been created.
I have a user event script with the following code.
function showValue()
{
var tranid = nlapiGetFieldValue('tranid');
nlapiLogExecution('DEBUG', 'save transaction', nlapiGetRecordType() + ", "+ nlapiGetRecordId() + ", "+ 'tranid' + ": "+ tranid + ", "+ (new Date()))
}
After Submit Function is set to showValue.
The deployment applies to Invoice.
Event Type is set to Create.
When I save a new invoice the following is added to the execution log for the deployment:
"invoice, 1143428, tranid: To Be Generated, Fri Oct 13 2017 04:21:08 GMT-0700 (PDT)"
How can the internal id be set but the tranid still be "To Be Generated"? Surely tranid would be set by the time that the internal id is set.
How can I get the tranid in a user event script?