Creating Scripted Link that Applies a Specific Incident Template to an Incident Form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2024 11:40 AM
I'm attempting to create a scripted link in conjunction with a Client Script. The does open to a new incident form but template isn't being applied to the Incident. The script and link were modified to able within my ServiceNow Instance.
I Checked the following
- I inspected the webpage and didn't locate any html error
- Cleared cache and cookies
- private web browser
Client Script
function onLoad() {
// Check if the URL contains the parameter for the template
var url = new GlideURL(window.location.href);
var templateSysId = url.getParam('sysparm_template');
// Apply the template if the parameter is present
if (templateSysId) {
g_form.setTemplate(templateSysId);
}
}
Scripted Link
<a href="https://your-instance.service-now.com/incident.do?sysparm_template=your_template_sys_id">Create New Incident</a>