How to trigger workflow from table record

Vijayakumar
Kilo Contributor

Hi, 

I have created a workflow using custom table, wants to trigger the workflow on each new entry in that table?

How to do that?

 

Thanks, 

Vijay

5 REPLIES 5

Joaquin Campos
Mega Sage

Hi,

 

You need to create a business rule that is launched on insert record on that custom table and trigger the workflow with this code:

 

var wflw = new Workflow();

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

 

Hope it helps!

 

Joaquín

Harish Vaibhare
Kilo Guru

Hi Vijaykumar,

 

workflow automatically will get started whenever you create new entry in table, and if you mention any condition in workflow condition then,when that condition is met then only workflow will get started.

 

regards,

Harish 

 

Jaspal Singh
Mega Patron
Mega Patron

Hi Vijay,

 

Since, workflow alredy attached to a table to it should automatically associate workflow. If not then you can pass requried condition to workflow as below. Click on the hamburger icon then Properties & then Condition tab as below.

find_real_file.png

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

by default workflow will trigger when new record is created on your custom table

Ensure the new workflow runs on your custom table

No need of business rule

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