use templates from call

Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

Im wondering if anyone know how I can use templates within call.

We had this function in our old system and ServiceDesk used it alot.

To explain it abit more. if Im looking at a call and for example say it is an incident. I then choose call_type "incident" and then also get the choos(if I want) which of the templates I want to use. After this I press "submit/save". This is very useful when it's quick incidents where servicedesk handles them. Then They just need to choose the right template at the call which then creates the incident and puts it as resolved etc. directly. Now they need to choose incident, press submit, right click, go into templates etc...

Anyone done this?

1 ACCEPTED SOLUTION

This is what I did to make it work. I did it with the OOB way to create incident since we have changed our way.


Preferable is to just copy the oob-rules etc. and edit that and inactive the OOB ones to still get the future upgrades on the originals once in case you want to see what is new etc.. Here I'm just editing the real ones.




1. Create a reference field on call named "incident template". When you create it you can choose any field you want since the template-table isn't in the choice list.


  * Choose Configure dictionary on incident template.


  * Change the reference field to the table template(sys_template).


  * Add the ref qual condition "Table IS incident" to just see incident templates.


call config dict.JPG



2. Edited the Business rule "CallTtypeChanged"


  * Add the following line: gr.u_incident_template = current.u_incident_template;


BR callTypeChanged.JPG



3. Create an UI policy so that the field "incident template" only shows if the call type is incident.


  * Set the condition to "Call type IS incident".


  * Make sure the "reverse if false" is checked.


  * Make a UI Policy Action on field "u_incident_template". and set visible to true.


call ui policy.JPG



Now everything with the call is done. And lets head to incident.




1. Do the same first step as we did with call. We'll make it exact the same if we want to build some more functionality later on it.


  * Create a reference field on call named "incident template". When you create it you can choose any field you want since the template-table isn't in the choicelist.


  * Choose Configure dictionary on incident template.


  * Change the reference field to the table "sys_template".


  * Add the ref qual condition "Table IS incident" to just see incident templates.




2. Create an UI policy that hides the field "incident template".


  * No condition since we never want the field to be visible. But we still need it in the form to be able to change it etc.


  * Make a UI Policy Action on field "u_incident_template". and set visible to false.


inc ui policy.JPG



3. Create a onLoad script that will apply the template when the incident is loading. Efter its applyed it will empty the incident template field otherwise it will apply every time the incident is loaded.


  * Add the following code:



function onLoad()


{


  //Get the value from the field.


  var template = g_form.getValue('u_incident_template');




  //Check so the field isnt empty


  if(template != '')


  {


  //Apply the template


  applyTemplate(template);


  //Wait 2 seconds before clearing the value with the function clearTemplate


  setTimeout(clearTemplate,2000);


  }


}






function clearTemplate()


{


  //Empty the field


  g_form.setValue('u_incident_template', '');


}





And now it should be working 😃 Let me know if you have any other questions.


View solution in original post

14 REPLIES 14

Victor Ruiz
Tera Guru

I dont have a solution for the CALL table but I have used this awesome solution provided by Mark Stanger which you can use to add a template button to your INC form.   http://www.servicenowguru.com/system-definition/advanced-templates/


Thanks,



I took a quick look at it and like you said it aint 100% what we are looking for, but Its pretty close. will give it some time later and look deeper and see what we can reuse 😃




My first thought is if we someone can use sysparm_something to throw in which template to use when I "submit" my Call. And that parameter is filled by a dropdownlist that shows what templates there are on incident.


Did you find a workable solution for this - I too would like the ability to assign a template to a call and have it create an incident based on that template and the contents of the call.



I've had a look at Victors suggestion but can't seem to make it work the way I want. At least it does add a nice feature to easily add a template to an incident.


Victor Ruiz
Tera Guru

Found a workaround for this which will work alongside Mark's template solution posted earlier:



1.   Create a reference field on the call form named u_template pointing to the sys_template table.


2.   In the BR (CallTypeChanged) find the section (ctype == 'incident') and add the following line: gr.u_template = current.u_template;


3. Find the (Apply Template) client script and comment out the following 2 lines:


//if(isLoading)


          //return;


Not a pretty solution but it works.   You'll have to play around with the commented conditions.