- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 12:12 AM
In the RITM backend form 'Catalog Tasks' related list, 'New' button should be visible only for Request management group.
Please suggest possible approaches for this.
Tried below script in list control but not works:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 10:07 AM
With that new requirement, if you want admins to only see the New button if the RITM is active, then you can add that to the else if condition:
if (!parent.active) {
answer = true; //hide the New button if the RITM is inactive
} else if (gs.getUser().isMemberOf('b0e4ae74975e9110902978ae2153af8a') || gs.hasRole('admin')) {
answer = false; //do not hide the New button if the RITM is active, and the user is a member of the group OR has the admin role
} else {
answer = true; //hide the New button if the user is not a member of the group and does not have the admin role
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 02:12 AM
If you are using this script in the 'Omit new condition' field, as you should, be aware that returning an answer of true means that the button will be omitted/hidden. So with your script the New button will only be hidden when the RITM is inactive and the user is a member of the group. Given the description of your requirement, it sounds like what you want is:
if (!parent.active) {
answer = true; //hide the New button if the RITM is inactive
} else if (gs.getUser().isMemberOf('b0e4ae74975e9110902978ae2153af8a') ) {
answer = false; //do not hide the New button if the RITM is active and the user is a member of the group
} else {
answer = true; //hide the New button if the user is not a member of the group
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 04:49 AM
Thank you for response and below script works for my requirement but admin not able to see 'New ' button, only 'New' button visible only certain group members , please suggest.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 10:07 AM
With that new requirement, if you want admins to only see the New button if the RITM is active, then you can add that to the else if condition:
if (!parent.active) {
answer = true; //hide the New button if the RITM is inactive
} else if (gs.getUser().isMemberOf('b0e4ae74975e9110902978ae2153af8a') || gs.hasRole('admin')) {
answer = false; //do not hide the New button if the RITM is active, and the user is a member of the group OR has the admin role
} else {
answer = true; //hide the New button if the user is not a member of the group and does not have the admin role
}