- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2017 12:48 PM
Hi All,
I am creating a problem record using a record producer. I need to create 2 problem tasks in the related list when a problem record is created. Is it possible to create problem tasks using script from record producer or is it possible to trigger a workflow when the record producer is submitted so that i can create tasks via workflow ?
Please help!
Thanks,
SD
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2017 01:01 PM
You should definitely be able to do this via the script that runs when the record producer is created. Just include something like this near the end of your script:
var probTask = new GlideRecord('problem_task');
probTask.initialize();
probTask.problem = current.sys_id; //This will ensure the Problem Task is tied to the Problem that was just created
//Add any other mappings you want here
probTask.insert();
probTask.some_field = test;
var task2ID = probTask.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2017 01:14 PM
It can be done either way. The script in the record producer is probably the best bet though.
You need to find out about the GlideRecord.
Unfortunately, this is an area where there's tons of pages in the documentation site, but I find it hard to get useful information.
Here's a link to a page showing how to use the insert:
You'll need something like this: ( but change the table name from u_ptask to match your table name )
var ptask = new GlideRecord('u_ptask');
ptask.parent = current.sys_id;
// update other fields in the ptask here
ptask.insert();