Create incident task while creating incident

karanpreet
Tera Guru

Hello,

I can successfully create an incident in ServiceNow by sending in a REST message to the incident table.

I need to also create an incident task for the incident being created, I know I can write a business rule to do this on the ServiceNow end but is there a way to create the task while creating the incident itself?

Any help is much appreciated!

Regards,

Karan

6 REPLIES 6

Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

Perhaps you can take the use of a workflow to trigger and do the stuff for you?



//Göran


K10
Kilo Guru

Hi Karan,



If you are looking for a standard task. I would prefer to use execution plan. You may choose Parent table as incident and child table as Incident Task.


Hi Ketan,



I have tried creating an execution plan but I don't see the tasks being created in the incidents.



I'm very new to ServiceNow so I don't have much information on execution plans.



Could you expand on the answer so as to point me in the right direction.



Thanks!



Regards,


Karan


sagarsharma
Giga Guru

Hi Karan,



To create incident task while creating an incident you can define a workflow with tasks in it which can be triggered on creation of incident also you can use below piece of code to execute you workflow


var w = new Workflow();


  wfSysId = w.getWorkflowFromName("Your_workflow_Name");


  w.startFlow(wfSysId, current, current.operation());



Regards,


Sagar Sharma



Hit like, Helpful or Correct depending on the impact of the response