Description: When the customer creates a return authorization for the items, we can deduct the specific amount of the return fee for every RA created by the customer using this method.
We need to create a discount item with a rate of positive discount, then we can add this item to every RA created. Below if the reference code for the standard suite commences advance returns and we create the work flow to update and add the discount item when the RA is created.

Suite Script 1:
ReturnAuthorization.Model
define('JJ.ReturnAuthorization.Model',
[
"ReturnAuthorization.Model"
],
function (
ReturnAuthorizationModel
)
{
'use strict';
_.extend(ReturnAuthorizationModel, {
// @method create
// @param data
// @return {Number}
The @method create function is used to create standard RA and add custom return fee
create: function(data) {
try {
var returnAuthorization = nlapiTransformRecord(
data.type,
data.id,
'returnauthorization'
);
var transactionLines = this.getTransactionLines(data.id);
this.setLines(returnAuthorization, data.lines, transactionLines);
returnAuthorization.setFieldValue('memo', data.comments);
returnAuthorization.setFieldValue('custbody_jj_return_fee', "155398"); //155398 is the discount item id
return nlapiSubmitRecord(returnAuthorization);
} catch (error) {
console.error('Error @ RA create function', error);
}
}
});
});
Work Flow:
