How to setValue status custom transaction (type basic) in suiteScript ?
Hi There,
I have custom transaction type basic and use standard status at tab statuses with show status field is set checked.
Then I declare any status like Draft, Open and Completed.
I have some condition using suitescript to make different status, as usual I will load that custom transaction then setValue the status field. but unfortunately the status not changed
var recordSPBP = record.load({type: 'customtransaction_spbp',id: id_spbp,isDynamic: true});recordSPBP.setValue('custbody_spbp_related_statistical', id_statistical);// I am trying make sure status field id is current using 'status'var status = recordSPBP.getValue('status');// I have the status value with value is 'Draft' as stringlog.debug('status '+typeof status, status);// Already try between setText or setValue, but the status not changed// recordSPBP.setText('status', 'Completed');recordSPBP.setValue('status', 'Completed');recordSPBP.save();
If I reference to SuiteAnswer 42031, the only way to change status on Custom Transaction is using workflow, and maybe can use action workflow script
May I ask where did you put your code in the part of the script? Is it BL, BS or AS? Also, does it prompt an error?
Originally I am using Schedule Script to trigger change Status of Custom Transaction, and of course, I am trying at another trigger like in BL, BS and AS.
But if you see in my script, I am using record.load, so this script can trigger at any trigger.
Then when running that script, no error appear
Status are usually a combination of type and letter (see this helpful article). Even if the system displays “Completed”, if you send it back it won’t understand it.
To be sure of your status real code, you should create a saved search by UI and use the “Netsuite: Search Export” Chrome addon and click on “Export as Script” after saving your Saved Search.
Hi Caroline, thank you for your reference,
But in my issue, I have issue change status in Custom Transaction type. in your reference is for Standard Transaction that already built in NetSuite.
And I already check using plugin NetSuite Export for saved search, unfortunately no one that condition can change status via script
This is ID Status of Custom Transaction
Internal ID Status Custom Transaction
This is value when I check at NetSuite Export Plugin
And this is my testing value of status field, and the output of value only description of Status (not ID)
// I am already try this combination recordSPBP.setValue('C'); recordSPBP.setValue('statusC'); recordSPBP.setText('C'); recordSPBP.setText('statusC'); recordSPBP.setValue('Custom137:C'); recordSPBP.setText('Custom137:C'); but no one that can change the Status from Draft (A) to Completed (C)
Hi Rian, You deleted the field Id in your set just for the examples right? Have you tried setValue with ‘orderstatus’ instead of ‘status’? I would try a setValue(‘orderstatus’, ‘C’) just in case as you are on a transaction custom record type.