is there a way to Apply an incident template based on caller location
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 09:34 PM
I have an Incident for Hardware Issues, and based on the caller Location they default to a different Assignment Groups.
I want to apply a template which has different information for the Help Desk based on the Caller Location.
Example is:
Caller in Australia needs to contact xxx and call needs to be closed
Caller in NZ ticket needs to be assigned to the Assignment Group
I would like the template to apply information based on when the Caller Location is eg. AU
Does anyone know if this is possible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 10:08 PM
Yes.. I think you can use client script "onload" or "onchange" to apply the template,
current.applyTemplate("<template name>");
Refer : Creating a Template - ServiceNow Wiki
How to apply an Incident template to an Incident Record Producer?
Thanks,
Vinitha.K

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 10:30 PM
You can apply a template in a client script.
leverage: applyTemplate(template_sys_id);
Have a read of this:
https://www.servicenowguru.com/system-definition/advanced-templates/
Mark your feedback( Like or Helpful or Correct) as per the impact of my response. Cheers!
Vab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 11:17 PM
Here is my solution-
create one onload client script on incident named: Choose Template By Location
Code:-
function onLoad() {
//Type appropriate comment here, and begin script below
var location=new GlideAjax('Get_Location_By_UserID');
var str_location='';
//alert('g_user.userID '+g_user.userName);
location.addParam('sysparm_name','GetLocation');
location.addParam('sysparm_userid',g_user.userName);
location.getXMLWait();
str_location=location.getAnswer();
//alert('applying template for:'+g_user.location);
//current.applyTemplate(" IncidentTemplateForKolkataLocation");
alert('str_location:'+str_location);
if(str_location=='Paris') // template will be applied for user with location Paris
{
applyTemplate('155224634f23320073f9cab18110c77f'); // Sys_id of your template
}
}
Create one client callable script include named : Get_Location_By_UserID
Code:-
var Get_Location_By_UserID = Class.create();
Get_Location_By_UserID.prototype = Object.extendsObject(AbstractAjaxProcessor, {
GetLocation:function(){
var userid=this.getParameter('sysparm_userid');
//gs.addInfoMessage('userid'+userid);
var location='';
var rec=new GlideRecord('sys_user');
rec.addQuery('user_name',userid);
rec.query();
rec.next();
location=rec.location.name;
//gs.addInfoMessage('location'+location);
return location;
},
type: 'Get_Location_By_UserID'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 11:55 PM
Did you already try the platform feature "Assignment Rule" for this? (Create an assignment rule)
I dont think your requirements justify using scripting instead of an OOTB feature.