Hi,
I am running a script to take some action after a Sales Order is approved. However, I think i'm missing something pretty simple.
I've stripped the code right down to a basic code to test and I can't even get that to work!
I have created a function as defined below:
function processApprovedSORealtime(type)
{
var record = nlapiGetNewRecord();
var entity = record.getFieldValue('entity');
var date = record.getFieldValue('trandate');
var items = record.getLineItemCount('item');
record.setFieldValue('memo','LOG:'+date+items);
}
All I'm trying to do here is to get the script to write into the memo field to confirm it's doing what I expect.
I have created a User Event Script and deployed it for Applied To = Sales Order and Event Type = Approve for all roles and employees.
However, when I approve a test Sales Order the memo field is not written to as I expect.
Am I missing something really simple? I'm guessing that during an approve the record isn't being written so my changes to the memo field don't get saved but I can't figure out how to get it to save the changes.
Any help would be greatly appreciated. It's 11pm here and I've been looking at this all day...
Cheers,
Charlie