- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2014 06:42 AM
Currently any incidents created by self service users has the "contact type" as "phone" which is our default value for the servicedesk. Is there anyway I can get this to change to our "self-service" option by default. On the self service view "contact type" is not a visible field so is set to phone by default when viewed by us and more importantly we cant track how many incidents are being raised by self service users.. Is there a way I can get it to default to self-service when non-itil users raise an incident using the self service view?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2014 07:51 AM
You probably only want the thing to run when it's loaded for the first time...
function onLoad() {
if(g_form.isNewRecord()){
if (g_user.hasRole("itil")) {
g_form.setValue("contact_type","phone");
}
else {
g_form.setValue("contact_type","self-service");
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2014 11:06 AM
Sounds like you guys have a working solution, but I wanted to throw out the option of scripting the default value to handle both situations, something like this for the default value field:
javascript:
if (gs.hasRole("itil")) { //modify to specific roles, or has any role etc as needed
current.contact_type = 'phone';
}
else {
current.contact_type = 'self-service';
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2014 07:16 AM
Hi Chris,
Have just tried adding this as a client script to the incident table and am receiving:
"
The object "current" should not be used in client scripts. | |||
Am I doing something wrong? |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2014 07:21 AM
Hi Gary,
If you want to put it in a client script, you can use this:-
if (g_user.hasRole("itil")) {
g_form.setValue("contact_type","phone");
}
else {
g_form.setValue("contact_type","self-service");
}
Thanks & regards,
Hari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2014 07:32 AM
Hi Harikrishnan,
This script works great for when the incident is created, however when someone with the ITIL role opens the incident to have a look it is defaulting it back from self service to phone.
I am thinking making the field a read only could solve the problem?
Thanks for your help
Garry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2014 07:34 AM
Update: even as read only the field still changes when the record is opened.