How do i trigger a standard change template in a workflow run script

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2019 01:50 AM
Hi,
I have Standard Change Template i would like to trigger in a run script on a workflow.
I tried this first
"
var rec1 = new GlideRecord("incident");
rec1.initialize(); rec1.applyTemplate("my_incident_template");
"
a solution from the playbook. But i didn't work.
So when googling I found this thred in the community
https://community.servicenow.com/community?id=community_question&sys_id=054e0beddb9cdbc01dcaf3231f96..."
In that thred that this template is a template out of a recordproducer and that why the playbook solution from activate a template didn't work.
So now i have been googling to mush, involving friends a colleags and reading the thread i linked, but getting nowhere.
So do we have any ServiceNow-Ninja, whitchdoctor, superskilled community member that can give this some thought and apply a solution that explains how it works and what to do?
Take care!
Marcus
Labels:
- Labels:
-
Scripting and Coding
6 REPLIES 6

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2019 04:11 AM
As i guessed, it is not so simple (tried it before)...
You get a blank change created... you allso need to include the version of the template i think somehow...
The empty change is when i ran it as a background script...
The other one is when created out of the standard change catalog
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2023 01:26 PM
It worked perfect for me, thanks.