I'm creating Return Authorization records by trans...
# suitescript
s
I'm creating Return Authorization records by transforming Sales Order records, but the resulting RMA does not have the "createdfrom" field filled out with the SO. I've tried setting that field in the script as well, and it's still not filled out. Any idea how to make sure createdfrom has the SO number?
b
what does the code look like
transforming sales order should correctly set the createdfrom unless you make a change that would remove that relationship
s
Copy code
rma = record.transform({
        fromType: record.Type.SALES_ORDER,
        fromId: soId,
        toType: record.Type.RETURN_AUTHORIZATION,
      });
I might have just figured it out. Would it be because I have
enableSourcing
set to
false
here after I set some of the fields?
Copy code
let rmaId = rma.save({
      enableSourcing: false,
      ignoreMandatoryFields: true,
    });
b
depends on the fields you are setting
as an example, setting the customer would destroy the created from relationship\
s
What other fields destroy the relationship?
b
probably lots
it probably be easier for you to start with no modifications and then slowly add on to it until you find the field causing the problem
s
That helped! Thank you!