Get value of old field in system note

Hi,

i have script for unreturn sales order , but i need to get value of old field in system information-> system note (amount to collect in drop off) to added to the code so i can put it in its field

this is the code:

var searchResult = nlapiSearchRecord(‘salesorder’, 5344);
for (var i = 0; i < searchResult.length; i++) {
    console.log(‘start: ‘, searchResult[i].getId());
    var R = nlapiLoadRecord(searchResult[i].getRecordType(), searchResult[i].getId());
    R.setFieldValue(‘custbody_sor_isreturned’, ‘F’);
    var puName = R.getFieldValue(‘custbody_ord_pickupaddressname’);
    var puAddress = R.getFieldValue(‘custbody_ord_pickupaddress’);
    var puDetails = R.getFieldValue(‘custbody_ord_pickupaddressextradetails’);
    var puLocation = R.getFieldValue(‘custbody_ord_pickuplocation’);
    var puContactNo = R.getFieldValue(‘custbody_ord_dispatcher_contact_no’);
    R.setFieldValue(‘custbody_ord_pickupaddressname’, R.getFieldValue(‘custbody_ord_droppoffaddressname’));
    R.setFieldValue(‘custbody_ord_pickupaddress’, (R.getFieldValue(‘custbody_ord_droppoffaddress’) || ”).replace(‘Return: ‘, ”));
    R.setFieldValue(‘custbody_ord_pickupaddressextradetails’, R.getFieldValue(‘custbody_ord_dropoffaddressextradetail’));
    R.setFieldValue(‘custbody_ord_pickuplocation’, R.getFieldValue(‘custbody_ord_droppofflocation’));
    R.setFieldValue(‘custbody_ord_dispatcher_contact_no’, R.getFieldValue(‘custbody_ord_receiver_contact_no’));
    R.setFieldValue(‘custbody_ord_droppoffaddressname’, puName);
    R.setFieldValue(‘custbody_ord_droppoffaddress’, puAddress);
    R.setFieldValue(‘custbody_ord_dropoffaddressextradetail’, puDetails);
    R.setFieldValue(‘custbody_ord_droppofflocation’, puLocation);
    R.setFieldValue(‘custbody_ord_receiver_contact_no’, puContactNo);
    var customerReturnAmount = (nlapiLookupField(‘customer’, R.getFieldValue(‘entity’), ‘custentity_cus_returnamount’) || 0) * 1;
    var OrderAmount = R.getLineItemValue(‘item’, ‘ amount ‘, 1) * 1;
    //if(isNotEmpty(customerReturnAmount))
    R.setLineItemValue(‘item’, ‘amount’, 1, (OrderAmount – customerReturnAmount));
    R.setFieldValue(‘custbody_sor_returnorder’, ”);
    R.setFieldValue(‘custbody_sor_returnfromorder’, ”);
    nlapiSubmitRecord(R) console.log(“End unReturnOrder”);
}
Rookie Asked on April 8, 2020 in SuiteScript.
Add Comment
1 Answer(s)

You can create a search on the record in question, and join to “system notes…” and get oldvalue from there.

Intermediate Answered on April 8, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor   Become a Sponsor