How to create a change task automatically based on particular Category on Change Request form?

Sasha8
Kilo Contributor

How to create a change task automatically when a particular category is selected on Change Request form?

1 ACCEPTED SOLUTION

Hi,

Go to WF editor.. open your change request workflow depending on type. 

In that depending on your process.. drag if condition activity. In that add code like below

answer = ifScript();

function ifScript()
{

  if(current.category == "YOUR CATEGORY"){
  return 'yes';
  }else{
  return 'no';
  }
}

Then for yes.. drag create task activity. 

Kindly mark the comment as a correct answer and helpful if it helps to solve your problem.

Regards,
Asif
2020 ServiceNow Community MVP

View solution in original post

8 REPLIES 8

asifnoor
Kilo Patron

Hello Sasha,

 

In your CR workflow, you can add a condition if category is your value, then create change task.

Another approach is you can write a after insert BR on change_request table with condition

category is "your value"

var gr = new GlideRecord("change_task");
gr.initialize();
gr.short_description = "your short desc";
gr.description="your desc";
gr.change_request=current.sys_id;
gr.insert();

Kindly mark the comment as a correct answer and helpful if it helps to solve your problem.

Regards,
Asif
2020 ServiceNow Community MVP

Sasha8
Kilo Contributor

Hi Asif,

Thanks for your help.

 

Regards,

Sasha

MGanon
Tera Guru

Created after this question was asked, the Flow Designer now covers this functionality. The "Change - Implementation tasks" (.../$flow-designer.do?sysparm_nostack=true#/sub-flow-designer/6bcd6a92731310108ef62d2b04f6a790) is an out-of-box example.

Catherin Stella
Tera Contributor

Hi I have a similar kind of situation along with ootb change tasks I wanted to add a change task if a field in change request called Change Reason field is Decommission/Repair and it should not create task if the same field values are selected as fix or Repair or None. How to achieve this in workflow. Please let me know thank you