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');
qty = itemreceipt.getLineItemValue('item', 'quantity', 1 );
itemreceipt.setLineItemValue('item', 'quantity', 1, '2' );
itemreceiptId = nlapiSubmitRecord(itemreceipt, true);
}
This creates an Item Receipt but it does not carry any reference to the original RA (createdfrom is blank) and the items do not carry over. I've reached the limits of the documentation on this. Can someone describe how to automatically create the Item Receipt from a Return Authorization so that they are properly linked. Thanks.
- Mike