how to assign a user to default assigned_to in SC-Task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2024 11:52 PM
Hi Guys,
How to default assign a particular user as default assigned to in SC_TASK.
Thank!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2024 04:17 AM
Hi @tGhadage use this code
(function executeRule(current, previous /*null when async*/ ) {
if (current.short_description.indexOf("Testing please ignore") > -1 && current.state == 3) {
current.assignment_group = "8a5055c9c61122780043563ef53438e3";
current.assigned_to = "sys_is of assigned to user";
}
})(current, previous);
Please mark my reply Correct/Helpful
Regards,
Sid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2024 12:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2024 12:25 AM
Hi @tGhadage ,
Create after insert business rule on sc_task table and use below script
current.assigned_to = current.parent.assigned_to;
If you want to compare from other table and populate assigned to use below script
(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);
Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2024 05:08 AM
first question to you -> are you using flow or workflow here?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader