- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2023 03:02 AM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2023 04:08 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2023 03:09 AM
HI @Hrishabh Kumar ,
I trust you are doing great.
- 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2023 03:48 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2023 04:08 AM
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