Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Need to run a workflow through Fix script

Abhishek Barik
Tera Contributor

Hi Team,
We have a requirement to force run a workflow through fix script. I am new to this procedure. Could you please help me in script to run a workflow through sample script that can help me?
Sample script:

var wflw = new Workflow();
wflw.startFlow(wflw.getWorkflowFromName('Vendor Guest Acc Sync'), 'insert');


Thanks in advance,

Abhishek

1 ACCEPTED SOLUTION

Allen Andreas
Tera Patron

Hello,

Please see this reply for some assistance: https://www.servicenow.com/community/developer-forum/run-workflow-from-background-script/m-p/1904248 

You need to associate the workflow to a record, thus you can use GlideRecord to either query an existing record and then use that object or you can use GlideRecord to insert a blank record and then associate that new blank record with the workflow. 

Both methods are in the link I provided.

Please mark reply as Helpful/Accept Solution, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

2 REPLIES 2

Allen Andreas
Tera Patron

Hello,

Please see this reply for some assistance: https://www.servicenow.com/community/developer-forum/run-workflow-from-background-script/m-p/1904248 

You need to associate the workflow to a record, thus you can use GlideRecord to either query an existing record and then use that object or you can use GlideRecord to insert a blank record and then associate that new blank record with the workflow. 

Both methods are in the link I provided.

Please mark reply as Helpful/Accept Solution, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Ankur Bawiskar
Tera Patron

@Abhishek Barik 

Can you share your complete fix script?

Also check point mentioned by Allen regarding GlideRecord

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader