UI action condition enhancement.

Hrishabh Kumar
Giga Guru

I have created a UI action on Server From.

and added a condition that only if the logged in user is a member of the current.assigment_group, they can use this UI action.

I need to add more conditions here:  

1) If logged in user is a manager of current.assignnment_group 

OR

2) If logged in user is deputy manager of current.assignment_group.

He will be able to use the UI action.

 

Note: gs.getUser().isMemberOf(current.assignment_group.name); only checks for groups in which the logged in user is a member, but it excludes the group where logged in user in manager or deputy manager.

 

I Have provided screenshot of my UI action and conditions, please let me know based on above requirement how can can I update the condition. 

UIS1.PNG

UIS2.PNG

1 ACCEPTED SOLUTION

Hrishabh Kumar
Giga Guru

I figured out the solution:

Use this combination of conditions in your condition field.

gs.getUser().isMemberOf(current.assignment_group.name) || gs.getUserID() == current.assignment_group.manager || gs.getUserID() == current.assignment_group.u_manager_s_deputy 

View solution in original post

3 REPLIES 3

Amit Gujarathi
Giga Sage
Giga Sage

HI @Hrishabh Kumar ,
I trust you are doing great.

  1. Check if the logged in user is a manager of the current assignment group:

 

var isManager = gs.getUser().isMemberOf(current.assignment_group.manager);

 

  • Check if the logged in user is a deputy manager of the current assignment group:

 

var isDeputyManager = gs.getUser().isMemberOf(current.assignment_group.deputy_manager);

 

  • Now, you need to combine these conditions with the existing one. Assuming the existing condition is stored in a variable called isMember, you can update it as follows:

 

var isMember = gs.getUser().isMemberOf(current.assignment_group.name);
var isManager = gs.getUser().isMemberOf(current.assignment_group.manager);
var isDeputyManager = gs.getUser().isMemberOf(current.assignment_group.deputy_manager);

if (isMember || isManager || isDeputyManager) {
    // Allow the user to use the UI action
} else {
    // Display an error message or disable the UI action
}

 


Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



Few questions:

1) are these two valid queries

   

var isManager = gs.getUser().isMemberOf(current.assignment_group.manager);
var isDeputyManager = gs.getUser().isMemberOf(current.assignment_group.deputy_manager);

 

I tried using the above solution and implemented it in this way, and it did not work.

condition!.PNG

 

Hrishabh Kumar
Giga Guru

I figured out the solution:

Use this combination of conditions in your condition field.

gs.getUser().isMemberOf(current.assignment_group.name) || gs.getUserID() == current.assignment_group.manager || gs.getUserID() == current.assignment_group.u_manager_s_deputy