Discussions
Transforming a Return Authorization -> Item Receipt
Perhaps I am going about this the wrong way - but what I would like to do is automatically generate the Item Receipt record when a particular user saves a new Return Authorization as they would only do this when customer/item is present so it is un-needed clicking to go through the process of manually clicking "Receive", ticking the boxes for the items, and then Save.
The code fired on a Return Authorization submit is:
var returnauthId = nlapiGetRecordId();
var recordType = nlapiGetRecordType();
if ((type == 'create') && (recordType == 'returnauthorization')) {
toRecord = 'itemreceipt';
itemreceipt = nlapiTransformRecord(recordType, returnauthId, toRecord);
itemreceipt.setFieldValue('landedcostmethod', 'WEIGHT');
itemreceipt.setFieldValue('landedcostsource1', 'MANUAL');