Ui Builder script get the user group
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2024 06:11 AM
hi
i work on ui builder and i need to check if the current user is part of specific group how i can get the group of my user in ui builder script?
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2024 10:42 AM
Hello Dolev,
You can start with the following script and modify according to record names and your requirement:
function evaluateProperty({api, helpers}) {
const userID = api.user.userID;
const grpCheck = await fetch(`/api/<your namespace>/<group_check_page>?sys_id=${userID}`);
//if not sys_user_group, try with other tables partaining to your UI Builder pages
const grpData = await grpCheck.json(); //data returns JSON with isMember key-value pair
if (grpData.isMember) {
return 'User is available or member of group';
}
}
Hope this helps!
Regards, Akash
_____________________________________________________________________________
Please mark it as helpful👍 or Accept Solution✔️ based on the response to your query.
Regards, Akash
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.