- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2023 06:21 PM
Can anyone help me in getting this as I need to auto populate Assigned to field in Change Request based on SCTASK Assigned to Field. In Change request Assignment Group is getting populated via workflow but Assigned to field should get populate based on SCTASK Assigned to field selection. @Ankur Bawiskar @Vasantharajan N
SCTASK Assigned to:
Change Request Assigned to:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2023 11:50 PM
@Arjun Reddy Yer - Please use the below code in your BR on sc_task table and check.
var ritm_sysId = current.request_item.toString();
var chGr = new GlideRecord('change_request');
chGr.addQuery('parent', ritm_sysId); // As you are setting Parent field on change request to RITM sys_id, As per the create task script you shared.
chGr.addActiveQuery(); // only use active change ticket. Please apply filters if rquired on state.
chGr.query();
if (chGr.next()) {
chGr.assigned_to = current.assigned_to.toString(); // Update the curret SC_TASK assigned to Change Assigned to
chGr.update();
}
Thanks & Regards,
Vasanth

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2023 06:58 PM
Hi,
You can use after BR on SC task (or flow) which should run after task is updated and assignd_to changes.
Business rule would be like below:
(function executeRule(current, previous /*null when async*/) {
var chGr = new GlideRecord('change_request');
chGr.addQuery('sys_id',current.request_item.u_related_change); // use field as per your configuration which stores related change ID
chGr.query();
if(chGr.next()){
chGr.assigned_to = current.assigned_to.toString();
chGr.update();
}
})(current, previous);
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2023 07:26 PM
u_related_change
Can I know which field it's referring to like Change Request Name or any another
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2023 11:05 PM
@Arjun Reddy Yer - How you are relating SCTASK with CHANGE request?
Thanks & Regards,
Vasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2023 11:37 PM - edited 04-09-2023 11:39 PM
By using workflow
Designed Workflow:
Script Used in Create Task:
var sgdt = new GlideDateTime(current.approval_set);
task.start_date = sgdt;
var days=11;
//assuming there are 8 business hours or use 24 if you want to use complete day in calculation
days = days*8;
var dur = new GlideDuration(60 * 60 * 1000 * days);
var schedule = new GlideSchedule('08fcd0830a0a0b2600079f56b1adb9ae'); //put sys_id of your schedule for weekdays here
var end = schedule.add(sgdt , dur);
task.end_date = end ;
task.short_description = current.number + ' ' + 'Standard change Request for Firewall Change Request'; //auto populating short description field with RITM number on Change Request
task.u_impacted_bu = current.variables.company; //auto populating Impacted BU on Change Request
task.justification = current.number + ' ' + 'Refer to Firewall Rule Service Request'; //auto populating RITM number on Change Request
task.parent = current.sys_id;
task.created_from = 'workflow';
task.priority = current.variables.priority;
task.u_loc_reg_cab = current.variables.testtest;
Business Rule Used in auto changing Change Request State to Schedule:
(function executeRule(current, previous /*null when async*/ ) {
var gr = new GlideRecord("change_request");
gr.addQuery("parent", current.request_item);
gr.query();
if (gr.next()) {
if (current.state == 2)
{
gr.state = -2; //choice Value For Scheduled
}
gr.setWorkFlow(false);
gr.update();
}
})(current, previous);