How to auto populate "Assign to" field present on the task record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-02-2024 09:41 AM
Need to auto populate the "Assign to" field present on the task record to the person who approved the ticket. Do es anyone have any ideas on how to do it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-02-2024 09:44 AM
Hi @sola2
What is use case ? and on which table you need this?
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-02-2024 10:01 AM
This is for the sc_task table. This is basically a HR request; approval is asked to the HR group and whoever approves it needs to be the "assign to" so that they can be responsible of fulfilling it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-02-2024 10:38 AM
@sola2 You would need to create a business rule as follows.
Here is the script
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var taskRec = current.sysapproval.getRefRecord();
taskRec.setValue('assigned_to',gs.getUserID());
taskRec.update();
})(current, previous);
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-06-2024 06:15 AM
Is there any extra steps you have to do? I have it exactly as showed above but I do not have the "task type" field.