Creating standard change template from workflow

shivaprasad3
Kilo Contributor

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.

find_real_file.png

10 REPLIES 10

Weston Wilson
Tera Expert

Is this getting created through a catalog task? Would a record producer work instead? That way, you could just map the fields directly to the table. Also, some of the fields you are trying to capture appear to be fields that would be on the request item itself, rather than in the variables. You could try current.short_description instead. 

Hi Weston,

Thanks for your idea.

I am not supposed to create record producer here since the request should get submitted first then post approval of the request this standard change template should get created.

I can remove variables in my script as per your suggestion.

Could you please let me know how can load the value to implementation plan,blackout plan (fields which i have shared in screenshot above) from the current catalog item.

I believe those fields are not from the "std_change_proposal" table hence i am not able to load the data to above fields.

Can you please share your idea to populate those fields from the above mentioned script.

 

 

 

Thanks and Regards,

Shivaprasd 

It looks like the value specified for the change values is in the form of an encoded query: 

short_description=Include a title for your change no greater than 100 characters^description=Describe what you plan to do^implementation_plan=List the steps in order of completion that will be worked through when implementing this change.

Note who will perform each step and whether there are dependencies
			between steps.^backout_plan=Describe the steps you will take to revert the change to its pre-implementation state.

At what point during the implementation will you take the decision to
			backout your change?

			Does your change window include time to backout if you need
			to?^test_plan=Explain what testing you have done or will do prior to implementation that gives you confidence this change will be successful.

Describe the tests that will be carried out after implementation to confirm
			that the change has been successful.^EQ

So you can mirror that format for updating the field. 

a.template_value='short_description=Some text^description=Some description^implementation_plan=plan details^etc....^EQ'

Hi Weston,

Thank you for the good idea.

 

I have used this script as you have suggested like below:

a.template_value = 'implementation_plan = some text';

 

The problem here is duplicate field of implementation plan is getting created with the text which is given.

Please let me know how to update the existing field instead of creating new field from the script.

Please find the screenshot of duplicate field for 'Implementation plan' under change requests values.

 

 find_real_file.png

 

 

 

Thanks and Regards,

Shivaprasad