How to populate last_changer field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2024 04:59 AM
Hi,
I created a new "u_last_changer" field in incident form and i need to autopopulate it with the user who changed the group in assignment_group field, only if the user is in a specific group type called "itil".
I tried to create a business rule but it doesnt work.
I would appriciate any help.
Thanks,
Sahar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2024 06:16 AM - edited 01-15-2024 06:19 AM
First, line 2 is wrong. The correct version is
var user = gs.getUser().getRecord();
Second user.group is not possible as the field "group" does not exist at table sys_user. A user can be a member of many groups, and therefore you have to look up all memberships at table sys_user_grmember.
It would be easier if you can assume that the user has a certain role, for example "itil". Then you can check:
if (gs.hasRole('itil')) {
}
And in that case you even could eliminate line 2.
Maik