- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 04:18 AM
There is a table called 'To-do' and a field type called 'Assigned to' having field type called 'list' . when there is new 'to-do' created or 'assigned to' get updated then a new 'to-dos' should be created eg.
I have created 'to-do record 1' and had assiged to 2 users (User 1, User 2)
then simultaneously two new 'to-do records' should be created assigned to 'User 1' and 'User 2'
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 05:00 AM
Creating a BR should do the work -
// retrieve the list of assigned users
var assignedUsers = current.assigned_to.split(",");
// Create new To-do records for each assigned user
for (var i = 0; i < assignedUsers.length; i++) {
var newToDo = new GlideRecord('To-do');
newToDo.initialize(); // fresh record is created
newToDo.copyValues(current); // copy values from the original record
newToDo.assigned_to = assignedUsers[i]; // Assign the current user
newToDo.insert(); // Create the new To-do record
}
Thanks,
Tushar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 05:00 AM
Creating a BR should do the work -
// retrieve the list of assigned users
var assignedUsers = current.assigned_to.split(",");
// Create new To-do records for each assigned user
for (var i = 0; i < assignedUsers.length; i++) {
var newToDo = new GlideRecord('To-do');
newToDo.initialize(); // fresh record is created
newToDo.copyValues(current); // copy values from the original record
newToDo.assigned_to = assignedUsers[i]; // Assign the current user
newToDo.insert(); // Create the new To-do record
}
Thanks,
Tushar