Auto Create Case Task from Case field value

MStritt
Tera Guru

Hello,

I would like to auto create a case task with certain field values (and it be auto saved), when a specific field is populated on the case. The field on the case (checkbox) will be auto checked when a specific update is automatically added to the activity stream of the case.

1 ACCEPTED SOLUTION

Not applicable

Add this code and check-

var lastComments = current.comments.getJournalEntry(1);
if(lastComments.indexOf('The customer called and requested a callback') > -1){
var childTask = new GlideRecord('sn_customerservice_task');
childTask.initialize();
childTask.assignment_group = "ff0370019f22120047a2d126c42e702b"; // replace the sys_id with sys_id of the group
childTask.parent = current.sys_id;
childTask.short_description = "Child Task Test";
childTask.insert();
}

 

I tried this on my PDI and it works:

 

Case:

find_real_file.png

 

Case Task:

 

find_real_file.png

View solution in original post

18 REPLIES 18

Hi! Thanks for the response.

Would this be a BR on the Case table?

Would I add the filter condition below? Also, would it be 'before' or 'after'? Also, would it be just 'Insert'?

find_real_file.png

 

Also, I want some of the fields on the Case Task to be configured with specific values. How would I configure the script for that?

find_real_file.png

Additional Information:

This is what will be added to the Case, that I wish to to kick off the auto creation of a Case Task.

find_real_file.png

Task Category: Escalation

Priority: 2 - High

Reason for Escalation: Callback

Assignment Group: SMB Team

Assigned To: Empty/blank

find_real_file.png

Thom11
Kilo Contributor

Could you not do a current.work_notes.changes() in the BR?

Yes, I suggest an after-BR on the case table.

 

Regards,
Thom

Thanks Thom.

I'm not experienced with scripting. How would I configure the script, to auto create the Case Task, and include the default choices I need (highlighted above).

 

Not applicable

Hi,

You can do this through an "After" "Update" BR on your Case table with Conditions "Additional Comment changes"

 

Script would be something like-

 

var lastComments = current.comments.getJournalEntry(1);
if(lastComments.indexOf('The customer called and requested a callback') > -1){
var childTask = new GlideRecord('NameOfYourChildTaskTable');
childTask.initialize();
childTask.assignment_group = "ff0370019f22120047a2d126c42e702b"; //Add the sys_id of the assignment group
childTask.assigned_to = '6816f79cc0a8016401c5a33be04be441'; //Add the sys_id of the assigned to

childTask.priority = 2;
childTask.insert();
}

 

You can similarly assign values to the 'Reason for escalation' and 'Task Category' fields