- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 01:14 AM
I have a requirement, I have 10 groups which start with same prefix. While creating new INCs we need to restrict assigning assignment groups. Only members of those 10 groups can only assign new INCs to those 10 groups. Other group members while creating new INCs should receive a error message.
Thanks in advance
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 01:49 AM
Hello Raviteja,
I would avoid working with Client Scripts in this case. ServiceNow does not recommend this for data validation purposes.
To achieve your requirements you can use a business rule. However looking into an advanced reference qualifier would be more useful.
The reference qualifier would only return the assignment groups that are allowed to be selected at the time being. However you'd need to add a script part to check if the current record is new or already existing.
Anyway, let me first guide you through the business rule and if you want to look into reference qualifiers, let me know and I'll help you.
Business Rule
Create a new "onBefore" business rule that runs only on inserts.
The condition should check if the assigment_group.name starts with your values
Then add a simple abort action that will trigger if the condition is true
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 01:23 AM
Create a role and assign it to that 10 groups.
Now write a onchange client script on assignment group to check if the login user has that role while creating an incident. If is then well and good and if no give the error message.
Check new record in Client Script: g_form.isNewRecord()
Check logged in user role in client script: g_user.hasRole('<role_name');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 01:39 AM
it should not check logged in user, but caller
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 01:46 AM
Ok. Fair enough. In that case you need to use GlideAjax to get the role of the caller.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 01:49 AM
Hello Raviteja,
I would avoid working with Client Scripts in this case. ServiceNow does not recommend this for data validation purposes.
To achieve your requirements you can use a business rule. However looking into an advanced reference qualifier would be more useful.
The reference qualifier would only return the assignment groups that are allowed to be selected at the time being. However you'd need to add a script part to check if the current record is new or already existing.
Anyway, let me first guide you through the business rule and if you want to look into reference qualifiers, let me know and I'll help you.
Business Rule
Create a new "onBefore" business rule that runs only on inserts.
The condition should check if the assigment_group.name starts with your values
Then add a simple abort action that will trigger if the condition is true