Ismemberof is not working in scoped app
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 03:53 PM
Hi Community
A field should be editable to the members of the Assignment group(assignment group backend value = network_security_group) . I wrote the below mentioned code on a Field level Write ACL but it is not working. Can you please take a look and let me know where am I going wrong ?
The first 2 conditions are working but the 3rd condition for "ismemberof" is not working.
Quick question - "ismemberof" doesnot work in scoped app ??
if (gs.hasRole('x_cld_fsg.FSG_CLD_SECURITY') || current.network_iga_contact == gs.getUserID() || gs.getUser().isMemberOf(current.network_security_group.getDisplayName().toString())) {
answer = true;
} else {
answer = false;
}
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 07:02 PM
Hi @knopbrent ,
isMemberOf() does work in scoped apps, please use getDisplayValue and you are missing a parenthesis at the start
if ((gs.hasRole('x_cld_fsg.FSG_CLD_SECURITY') || current.network_iga_contact == gs.getUserID() || gs.getUser().isMemberOf(current.network_security_group.getDisplayValue())) {
answer = true;
} else {
answer = false;
}
If my answer has helped with your question, please mark it as correct and helpful
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2023 12:02 PM
I have tried with "getDisplayValue() and also added the parenthesis, it did not work. Is there any other way that we can implement this ? or am I missing something ?
@Ankur Bawiskar - Do you have any idea ? where am I going wrong ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2023 12:31 PM
Hi @knopbrent ,
Hope you are doing great.
"ismemberof" should work as expected in scoped app too. However, please ensure that you have the necessary access controls and configurations in place for the scoped app to function correctly.
below script works in PDI :
var current = new GlideRecord('incident');
current.get('8d4cbaab97722110466eb666f053af8c');
if (gs.getUser().isMemberOf(current.assignment_group.getDisplayValue())) {
var answer = true;
} else {
var answer = false;
}
gs.info(answer);
PFB screesnhot:
Try incorporating the same add on condition in your script, something as like below :
if(gs.getUser().isMemberOf(current.network_security_group.getDisplayValue()) || gs.hasRole('x_cld_fsg.FSG_CLD_SECURITY') || current.network_iga_contact == gs.getUserID()) {
answer = true;
} else {
answer = false;
}
Regards,
Riya Verma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2023 05:26 PM