0
votes

I'm trying to add a field to item sublist on sales order record that copies the original value of another field when ever it is changed. It pretty much preserves the previous value of another field. When ever I do a nlapiGetCurrentLineItemValue at Validate field trigger in my client script, it is giving me the new value(changed by user) not the one before changing it. Is there a way to get the value of a field before it is edited at validatefield event in client script? or by any other ways?

function validateFieldChanged(type, name, linenum) {
    if (type == 'item' && name == 'custcol_commit_date') {               
        nlapiSetCurrentLineItemValue('item', 'custcol_last_commit_date', nlapiGetCurrentLineItemValue('item', 'custcol_commit_date'), true,true);
    }
    return true;
}
1

1 Answers

1
votes

I've previously done something similar.

At the top of your script, declare a variable such as var existingValue;

Then in your lineInit function, get the field value and store it in existingValue.

Then when you have your validateField, you compare the be value with the existingValue.