- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2016 03:44 AM
My requirement is "When Create New Incident is clicked and the created member is not a member of a Service Desk, the Contact Type should default to Self-Service, else to 'Phone'.
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2016 06:59 AM
If they are allowed to pick anything, then I would recommend the business rule. The user experience would look something like this.
- Any user enters the form (service desk or anyone else.)
- They fill out the form including the contact type.
- No matter what they pick, if they are service desk, it gets set to self-service when the record is created. If not, they are set to phone. This is the business rule I wrote above. It does not apply to users with admin role. They stay with what they picked.
- If they like, they can go back and change it later as the business rule doesn't apply to 'update' operations, only insert.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2016 04:08 AM
Hi Akash,
You can write a onLoad script which gives only two options either self-service or phone for users who doesn't belong to 'Service Desk' group:
function onLoad() {
var user = g_user.userID;
var ir = new GlideRecord('sys_user_grmember');
ir.addQuery('group', 'd625dccec0a8016700a222a0f7900d06');
ir.addQuery('user', user);
ir.query();
if(ir.next()){
g_form.removeOption('contact_type','email');
g_form.removeOption('contact_type','walk-in')
}
}
Hope this serves your requirement
Kind Regards,
Poojitha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2016 04:11 AM
Requirement is to perform this task from Dictionary Overrides, as this would be the best practice.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2016 06:08 AM
Hi Akash,
A dictionary override is used to set a default value different than the base (parent) table. For example, the default state for incident can be 2 while the default state for task is 1. It's meant to be a table thing, not a condition thing.
The use case you've given sounds like a business rule than a dictionary override.
Something like this:
Name: Set default contact type
When: before
Insert: checked
Update: NOT checked
Condition: (empty)
Script:
if (gs.getUser().isMemberOf('Service Desk'))
current.contact_type = 'self-service';
else
current.contact_type = 'phone';
Note; this is untested and may require tweaking on option names and other areas.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2016 06:45 AM
Ok, let me turn to scripting then, and can you suggest the best practice for this?
Client side scripting or business rule