Trigger a workflow from inbound action

Indup
Tera Expert

HI friends,

I want to trigger a workflow from inbound action. Can some one give me the lines of code plz. 

https://community.servicenow.com/community?id=community_question&sys_id=ffc5c721db1cdbc01dcaf3231f96...

i seen this link, but i am doubtful that how can we use workflow sys id as it changes every time we checkout and publish. So how to do this? 

Also tell me how to get the sys id of a workflow.

 

Thanks in advance

 

 

Regards,

Indup

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

use below script; give your workflow name

var workflowRec = new Workflow();

workflowRec.startFlow(wflw.getWorkflowFromName('give the workflow name'), current, 'update');

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

View solution in original post

9 REPLIES 9

Hi,

can you post a new question for this as this is quite older thread?

Regards
Ankur

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

Ankur,

 

If I am getting variables from the email body in my Inbound Action like in this example:

var userInitials = email.body.initials;
var branch = email.body.branch;

How can I pass those variables to the workflow and use them in it if I am calling the workflow from a script?


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

Hi Ankur,

 

I am doing the same but it is not calling the workflow, Can you help me what could be reason.

 

I have added above 2 lines as it is with workflow name.

 

Thank You

Ct111
Giga Sage

Hello,

It refer the below blog it will give you proper understanding of how do it .

https://community.servicenow.com/community?id=community_blog&sys_id=c25da629dbd0dbc01dcaf3231f961933

 

Mark my ANSWER as CORRECT and HELPFUL if it helps.

Apeksha Joshi
Kilo Guru