How to populate last_changer field

Sahar_Kaizer
Tera Contributor

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.

Sahar_Kaizer_0-1705323438447.png

 

Sahar_Kaizer_2-1705323561183.png

 

 

 

I would appriciate any help.

 

Thanks,

Sahar.

1 REPLY 1

Maik Skoddow
Tera Patron
Tera Patron

Hi @Sahar_Kaizer 

 

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