How to start a workflow from script include using UI action?

animeshmishra02
Kilo Contributor

Hi All

We have a requirement to trigger workflow using UI action. We are able to call script include from UI action but not able to call workflow.

Thanks in advance,

Regards,

Animesh

13 REPLIES 13

Oops. Force of habit.


lol, its ok reply to the person that created this Thread so they can mark as correct. For all of us, .   I would say the answer is in here somewhere as we went through the best and safe way to start a workflow.


Raju13
Kilo Explorer

I'm writing a scoped application, in that I have UI action button .

When we click on theat button,  state  field value(current in Inprogres) should be changed to Submitted by triggering the workflow.

Can any one please help me.

 

Thanks,

Raj.

kushal Tayade
Mega Guru

Hi,

 

Use below code to trigger workflow.

////where current is a task record with a workflow context
      var w = new Workflow();
      var context = w.startFlow(id, current, current.operation(), getVars());

 

Also, you can go through below link to understand

 

https://developer.servicenow.com/app.do#!/api_doc?v=london&id=r_WF-startFlow_String_GR_S_A