Update RMA lines when they have associated revenue elements

Is there a way to update RMA lines when they have revenue elements associated with them? I am getting the following error when attempting to do so:

“You cannot change the item on this line because it has an existing revenue element. Delete the line, and enter a new line to correct the item.”

When creating RMAs I also received this error, but was able to resolve it upon creation by utilizing the following UE:

 function beforeLoad(context) {
    var salesOrder = context.newRecord.getValue('createdfrom');
    var lineCount = context.newRecord.getLineCount({sublistId: 'item'});
for (var i = 0; i < lineCount; i++) {
    try { var currentItem = context.newRecord.getSublistValue({ sublistId: 'item', fieldId: 'item', line: i }); var attachedToRevenueElement = context.newRecord.setSublistValue({ sublistId: 'item', fieldId: 'attachedtorevenueelement', value: false, line: i }); } catch(e) { log.error('Error setting attached to revenue element boolean value', e.message); }}}

 

Rookie Asked on February 15, 2021 in SuiteScript.
Add Comment
0 Answer(s)

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