I am facing issue while creating return authorizat...
# general
k
I am facing issue while creating return authorization of sales order via suitelet using transform method (suiteScript 1.0). the error is “Invalid item reference key 27211 for subsidiary 9.” the item is service item with parent subsidiary and has the “include children” checkbox checked. the customer for which the Rtn is being created is of child subsidiary. I am able to create the return authorization via UI but not with the suitescript.
t
Try to recreate the issue manually in the UI, it may help debug the issue or at least better understand it
v
Check if service item has the option can be fulfilled/received enabled. Only if it's enabled, it allows receiving or fulfilling the item via IR/ IF.
k
even after enabling that option i am getting the same error.
and @toltmanns , sorry I forgot to mention that i am able to create return authorization in UI but in the suitescript im getting that error
t
Are you sure that there isn’t another script at play aside from the suitelet? You are using the exact same testing data/scenario in the UI AND the script?
k
@toltmanns yes
by the way issue was resolved. thanks @Vinod and @toltmanns for your help. appreciate you time.
t
For posterity, what was the issue?
k
They were using transform method and setting the line item manually, that is what causing the error, i commented out that and code works. If you know the reason behind this then please share it. And if you want i can share the code as well. var returnRec = nlapiTransformRecord('salesorder', salesOrderId, 'returnauthorization'); returnRec.setFieldValue('customform', '110'); var locationId = ProcessRTNLoc(returnRec.getFieldValue('location')); returnRec.setFieldValue('location', locationId); //returnRec.setFieldValue('custbody_ready_to_ship', "F"); returnRec.setFieldValue('custbody_tile_rtn_type_of_return', 2); returnRec.setFieldValue('custbody1', refundRMACat); returnRec.setFieldValue('custbody_dsg_rma_subcategory', refundRMAList); returnRec.setFieldValue('custbody_dsg_rma_instructions', refundRMAInstr); returnRec.setFieldValue('custbody_orig_so_no', salesOrderNumber); returnRec.setFieldValue('custbody_tile_created_by_agent', email_cc_post); /* var count = returnRec.getLineItemCount('item'); var newItem = []; var newQuantity = []; var newRate = []; for (var j = 0; j < count; j++) { var oldItemType = returnRec.getLineItemValue('item', 'itemtype', j + 1); oldItemType = MapItemId(oldItemType); var oldItem = returnRec.getLineItemValue('item', 'item', j + 1); newItem[j] = oldItem; newQuantity[j] = returnRec.getLineItemValue('item', 'quantity', j + 1); newRate[j] = returnRec.getLineItemValue('item', 'rate', j + 1); } for (var k = 0; k < newItem.length; k++) { if (newItem[k]) { returnRec.setLineItemValue('item', 'item', k + 1, newItem[k]); returnRec.setLineItemValue('item', 'quantity', k + 1, newQuantity[k]); returnRec.setLineItemValue('item', 'rate', k + 1, newRate[k] || 0); } else { var msg = "Return Item is defined for items on sales order!"; nlapiLogExecution('DEBUG', 'msg:', msg); throw msg; } } */