Change Model Restriction to Some Group Members
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2023 02:18 AM
Hello All,
I want my change request to be available only for certain Assignment groups based on my Assignment group department value. (Department value is a custom field on my groups table). If the Department value is only something XXX then for those Assignment groups only it should be visible. Therefore for other Assignment groups it should not be visible in change landing page. How to achieve using scripting in available for section in change model. Can anyone help me on this.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2023 08:28 AM
@Ankur Bawiskar
I have even add log to my code..But no logs were displayed. Yeah I am using the correct sys_id only. I had also another scenario restriction of Change model in my pdi.
Scenario:
If a Assignment group has manager empty then for those users we should restrict the visibility of Emergency Change Model in Change Landing Page. In vice versa If Assignment group has manager not empty then for those users Emergency Change model should be visible in Change Landing Page. I added the below code under Available for related in Change model user criteria
var rec = new GlideRecord('sys_user_grmember');
rec.addQuery('user', user_id);
rec.addEncodedQuery('group.managerISNOTEMPTY');
rec.setLimit(1);
answer = rec.hasNext();
The above code also didn't work ..no logs were also displayed even when i gave log messages. Can you please help me what's the mistake in code and why my change model is not been restricted properly