Creating standard change template from workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2019 06:15 AM
Hi All,
I wanted to create the standard change template from workflow.
The workflow is triggering for one of the catalog item where all the required information are captured.
I have created the below script to create standard change template and template is getting created but i am not able to pull the values to fields like Implementation plan,backout plan , justifications,category and subcategory fields as these fields are from 'Change request values' section.
var a = new GlideRecord("std_change_proposal");
a.initialize();
a.opened_by= current.variables.RequestedBy;
a.business_justification = current.variables.justification;//which is not working as expected
a.std_change_producer = current.variables.short_description;//which is not working as expected
a.short_description = current.variables.description;//working as expected as this field is available in std_chg_propasal
a.category = current.variables.category;//which is not working as expected
a.description = current.variable.description;
a.implementation_plan = current.variables.implementation_plan;
a.insert();
Please let me know how to pass the values to "implemention plan,backout plan,justification,category and subcategory" which are available in the standard change template.please find the screenshot for same.
- Labels:
-
Change Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2019 06:28 AM
There is a business rule Add missing mandatory fields to template, which populates the template_value field with all required fields on the dependent table (change). It seems like it may be incorrectly populating fields that are not mandatory. If those fields are incorrect, you can disable the business rule to get just the fields you want.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2019 06:56 AM
Hi Weston,
Thanks for your help.
I will check the business rule which you have mentioned.
One more thing that is I dnt want to hardcode the value for 'Implementation_plan' but i want to push the value for 'implementation_plan' from the catalog item's variable and I have created the below scripts but its not working as expected,please share me idea to push the value from catalog.
a.template_value = 'implementation_plan = '+current.variables.implementation_plan^'risk_impact_analysis='+current.variables.risk_impact_analysis^'backout_plan ='+current.variables.backout_plan^'test_plan ='+current.variables.test_plan;
only the last field getting populated not rest of the field.
Please share your suggestion to push the value for those fields from catalog item.
Thanks and Regards,
Shivaprasad KN

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2019 08:13 AM
I think that just needs to be modified to have the ^ in the quotes.
a.template_value = 'implementation_plan= '+current.variables.implementation_plan'^risk_impact_analysis='+current.variables.risk_impact_analysis'^backout_plan='+current.variables.backout_plan'^test_plan='+current.variables.test_plan;
If any of my replies are helpful, please mark them as helpful or correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2019 10:04 AM
Hi Weston,
Thank you for your kind help till.
I have used below script to set the value for 'implementation plan,risk analysis,backout plan,test plan" but only first one is getting populated.
a.template_value = 'implementation_plan ='+current.variables.implementation_plan ||'risk_impact_analysis='+current.variables.risk_impact_analysis ||'backout_plan='+current.variables.backout_plan ||'test_plan ='+current.variables.test_plan;
I believe only we can hardcode the fields from ^ operator but we cant set.
To separate the variables I have used ||,&& and ^ operator but these were not providing expected results.
Could you please let me know how can I set the above fields from the script.
Please share me your thoughts on the same.
Thanks and Regards,
Shivaprasad kn

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2019 10:50 AM
The ^ character needs to be inside the quotes for the script to work. This is something the field itself is expecting as a string.
a.template_value = 'implementation_plan='+current.variables.implementation_plan'^risk_impact_analysis='+current.variables.risk_impact_analysis'^backout_plan='+current.variables.backout_plan'^test_plan='+current.variables.test_plan;
Please make sure that the caret is in the quotes and I think that should fix the fields populating. When I run a business rule this way, it is working properly, so as long as the field names are correct, it should work in the workflow script.