i need script to assign any random user from vendor table to engagement table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2024 11:25 PM
i need script to assign any random user from vendor table to engagement table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2024 11:31 PM
Duplicate question: https://www.servicenow.com/community/developer-forum/script-to-assign-random-user-from-user-table-to...
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2024 11:39 PM
Hi @Nandhini Sri ,
Hi @Nandhini Sri ,
Please following the following steps:
1. Go to Business rules list
2. Create New
3. Give any name
4. In table field select "vendor table" and check the "advanced" check box as true
5. In "When" field select "Asynch" or "After" (any one of these is fine)
6. Check the check box "Insert" as true
7. Condition : As per your Requirement
8. Go to Advanced section
9. Write the following script in it
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord("sn_audit_engagement");
gr.initialize();
gr.<field_name1> = current.<field_name1>;
gr.<field_name2> = current.<field_name2>;
gr.<field_name3> = current.<field_name3>;
//repeat above for all the required fields
gr.update();
})(current, previous);
10. Save