Creating Problem Tasks Automatically
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2014 12:47 PM
I'm currently working in the Aspen release of SN and I'm trying to automatically create 2 tasks when a new problem is submitted. I've tried using a workflow but that didn't work. I tried an onSubmit client script and that doesn't seem to be working either. Below is the client script I setup:
function onSubmit() {
//This script creates 2 new problem tasks
var newtask1 = new GlideRecord('task');
newtask1.initialize();
newtask1.short_description = 'Create Root Cause Analysis (RCA)';
newtask1.assigned_group = 'Problem Mgmt';
newtask1.assigned_to = '1. Queue Coordinator';
newtask1.insert();
var newtask2 = new GlideRecord('task');
newtask2.initialize();
newtask2.short_description = 'Create Problem and Resolution Plan';
newtask2.assigned_group = 'Problem Mgmt';
newtask2.assigned_to = '1. Queue Coordinator';
newtask2.insert();
}
Thanks to all who have suggestions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2014 01:47 PM
A WF should be your answer. Attach the workflow when the problem is created.
Or you could use a BR on Insert to create the tasks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2014 01:53 PM
Looks like the problem record should referenced each task; my guess would be the tasks are probably getting created, just not associated to your problem.
Something like this might work? (In Demo13 problem workflow at the moment - not sure if on Aspen they're just tasks instead of problem tasks.)
function makeProblemTasks()
{
var newtask1 = new GlideRecord('problem_task');
newtask1.initialize();
newtask1.parent = current.sys_id;
newtask1.problem = current.sys_id;
newtask1.short_description = 'Create Root Cause Analysis (RCA)';
newtask1.assigned_group = 'Problem Mgmt';
newtask1.assigned_to = '1. Queue Coordinator';
newtask1.insert();
var newtask2 = new GlideRecord('problem_task');
newtask2.initialize();
newtask2.parent = current.sys_id;
newtask2.problem = current.sys_id;
newtask2.short_description = 'Create Problem and Resolution Plan';
newtask2.assigned_group = 'Problem Mgmt';
newtask2.assigned_to = '1. Queue Coordinator';
newtask2.insert();
gs.addInfoMessage("Built new tasks, "+newtask1.number+' and '+newtask2.number);
} makeProblemTasks();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2014 02:23 PM
Morgan, what you sent was it. Based on everyone's input and this last post from you, that fixed it! Your script was spot-on! Thank you everyone!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2014 12:54 AM
first thing, client script does not support insert,update ans delete glide operation.You have to write a before insert or after insert business rule.
Thanks
Harsh