Populate templates in a reference field based on Groups selected in template..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2024 03:16 AM
I have created a custom field called Template in a table which is referencing to the sys_template table, now the requirement is to only populate those template records from sys_template table in the template field for which the logged in user is member of the groups selected in sys_template record while creating the template or Global checkbox is checked...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2024 05:07 AM
Hi @micky09
Please create Before Business Rule with the following script-
(function executeRule(current, previous, operation) {
//
var currentUser = gs.getUser();
var templateGroups = current.getValue('groups'); // Assuming 'groups' is the field referencing groups in sys_template table
// Check if the Global checkbox is checked
var isGlobal = current.getValue('global_field'); // Replace 'global_field' with the actual field name
if (isGlobal || currentUser.isMemberOf(templateGroups)) {
// User is member of the groups or Global checkbox is checked, allow the operation to proceed
gs.log('User is authorized to use this template');
} else {
// User is not authorized, cancel the operation and display a message
gs.addErrorMessage('You are not authorized to use this template.');
current.setAbortAction(true);
}
})(current, previous, operation);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2024 02:19 AM
Hi Amit, Thanks for the reply, but as I said we created a reference field called as Template which reference to sys_template table and we need to hide the templates from the users in that field for which user is not member of the selected groups
so we need to show only those templates in that field for which user is member of the group for example u can see in the image CAB Approval..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2024 02:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2024 02:43 AM
No, I need to create a reference qualifier where in template field only those templates will be visible to the user who is a member of the groups added in the sys_template record as mentioned in the screen shot or he or she have knowledge_manager role..