Applying a checklist template to an incident by client script?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2024 02:26 PM
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2024 03:11 PM
Hello @Cheski Frank ,
You can use applyTemplate("sys_id_of_template") in your onChange client script to apply a template.
//Example code when category is hardware apply specific template
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
try {
if (newValue == 'hardware') {// specific condition
applyTemplate('ba93821883c156105dfdf7c6feaad3f8');// template sys id
//Clear the template once it is applied
window.setTimeout(clearTemplate, 2000);
}
} catch (e) {
//alert(e);
}
}
function clearTemplate() {
g_form.setValue('u_template', '');
}
If this solution helps you then, mark it as accepted solution ✔️ and give thumbs up 👍!
Thanks,
Alka

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 06:59 AM
Hi @Alka_Chaudhary ,
That works for incident templates but not for checklists. Apparently that requires some server-sided lookup (script include)? Looking with a developer, thought it would be much easier.
Kind regards,
Cheski