- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2017 10:41 AM
We have a custom application named "Desktop Services". Within that, we have a table named "Desktop Services Table", which is an extension of the Task table.
To the "State" field, we added a custom choice option of "Never Hired". I would like to add a Business Rule that does the following:
When the State field is set to "Never Hired", the following changes should happen to the User record that this Desktop Services task is for:
- Update the Term Date field (u_term_date) to match the value in the Last Hire Date field (u_hire_date)
- Uncheck the "active" checkbox
- Check the "term ticket generated" (u_term_ticket_generated) checkbox
I know how to set the Business Rule to run on the update of the State field in the "Desktop Services" table, but I am unsure how to write the Business Rules script that would then make these three updates to the corresponding User record.
Thanks
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2018 10:28 AM
Here you go
var usr = new GlideRecord('sys_user');
usr.addQuery('sys_id',current.<user sys id>);// or get user sys_id from desktop service task table
usr.query();
while(usr.next()){
usr.u_term_date = usr.u_hire_date;
usr.active = "false";
usr.u_term_ticket_generated = "true";// provided this is Boolean column
usr.update();
}
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2019 03:23 AM
Hi
I am still unable to implement your code
i am trying to update a custom built table when a new record is inserted in the user table based if the id's match (not sys_id).
Thanks