Load a template based on a field value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2016 12:47 PM
Hi,
We have a requirement to load a template on new_call table which sets the description field to some value. This template has to load when a field "Call Type" changes to incident. I am trying to write an onChange client script using applyTemplate("<template name>"). But it does not work.
Has anyone implemented something similar?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2016 12:53 PM
Perhaps this blog post I wrote would give you an idea:
Using incident templates direct from calls
//Göran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2016 12:58 PM
Hi Goran,
Thank you for your quick response. I am going to try it out. However, the requirement I have is a little different. We would want the template to load on the new_call table itself as soon as the call type is set to incident. Is there a way to do that?
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2019 06:43 AM
Did you manage to solve this? How?
I'm looking for the exact same thing at the moment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2019 01:14 PM
Hi Henrik,
I saw I missed her reply for 3 years ago, but do I get it right with that you want to load add apply a template on the call form when call type is changed to incident?
If this is the case I just created a template on the call table, went to sys_template and got the sys_id of the template record. Then I created a onChange client script on the call type field with this code.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (newValue == 'incident')
applyTemplate('4ec1855c130f2b40a52c721a6144b04a');//The sys_id of the template I created on call table.
}