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 string
            log.debug('status '+typeof status, status);
// Already try between setText or setValue, but the status not changed
            // recordSPBP.setText('status', 'Completed');
            recordSPBP.setValue('status', 'Completed');
Rookie Asked on March 8, 2023 in SuiteScript.
Add Comment
3 Answer(s)

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.

RE: How to setValue status custom transaction (type basic) in suiteScript ?

Rookie Answered on March 9, 2023.

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 TransactionInternal ID Status Custom Transaction

This is value when I check at NetSuite Export Plugin

Check in NetSuite ExportCheck in NetSuite Export

And this is my testing value of status field, and the output of value only description of Status (not ID)

Log Debug Field StatusLog Debug Field Status

// I am already try this combination

but no one that can change the Status from Draft  (A) to Completed (C)

on March 9, 2023.

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.

on March 10, 2023.
Add Comment

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

Rookie Answered on March 8, 2023.
Add Comment

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?

Rookie Answered on March 9, 2023.

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

on March 9, 2023.
Add Comment

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   Become a Sponsor   Become a Sponsor