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

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

HI Ankur,

 

in the second line you mentioned, where does that wflw come from?

please explain

 

 

Regards,

Indup

Hi,

you can get the workflow name from this table 'wf_workflow'

Go to wf_workflow.LIST and search for your table and workflow name

Regards
Ankur

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

@Ankur Bawiskar 

Could you help me with my question?  if I am getting a user's initials from an inbound action like the following:

var userInitials = email.body.initials;

How can I pass that variable to a workflow I am triggering from am inbound action?  Normally with a catalog item it would be current.variables...or it could be a workflow input...but not sure how to pass the inbound action email variable to a triggered workflow.


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