0
votes

I'm trying to mark a Return Authorization as Approved.

var returnAuth          = nlapiTransformRecord('invoice',invoice_id,'returnauthorization',true);
      returnAuth.setFieldValue('customform','84');
      returnAuth.setFieldValue('approvereturn','T');
nlapiSubmitRecord(returnAuth);

I've tried using the approvereturn,'T' to see if it approves the RA. BUt nothing happens.

Is there something I'm missing as all I want to do is transform the invoice into an RA and have it approved so I can generate a cash refund off it.

Or am I missing something completely when trying to do this?

3

3 Answers

0
votes

Try the following:

var returnAuth = nlapiTransformRecord('invoice',invoice_id,'returnauthorization');
returnAuth.setFieldValue('customform','84');
nlapiSubmitRecord(returnAuth, true, true);

The parameters for 'nlapiSubmitRecord' are set to "true" for doSourcing - which indicates that field values will be sourced from the original record(Invoice). 'ignoreMandatoryFields ' is set to true, so all mandatory fields do not need to be set. You can change this once you get the operation working.

0
votes

Try Below Code

var returnAuth          = nlapiTransformRecord('invoice',invoice_id,'returnauthorization',true);
      returnAuth.setFieldValue('customform','84');
      returnAuth.setFieldText('approvereturn','T');
nlapiSubmitRecord(returnAuth);
0
votes

For suite script 2.0 this works

returnAuth.setValue({
                fieldId: 'orderstatus',
                value: 'B'
            });
returnAuth.save();

i think this should work for suite secript 1.0

returnAuth.setFieldText('orderstatus','B');
nlapiSubmitRecord(returnAuth);