Copy Change Modification

mah1
Kilo Sage

We added a custom field to Change Request which indicates the environment the Change is slated for. The choices are QA or Production. We added a few additional custom fields related to this. These are copy_to_prod (true/false) and related_change.

 

We made a copy of UI Action Copy Change and named it Copy To Production.  Copy To Production is available when the environment is QA. That is, you can make a copy of a QA change and slate it for Production. Copy To Production is available regardless of the type - Normal, Standard, Emergency.

 

This is working in our Production instance which is Xanadu Patch 4a.  We cloned our Production instance to our Development instance and upgraded our Development instance to Xanadu Patch 6.

 

We discovered that Copy To Production is no longer working correctly in our Development instance.

 

In the Copy To Production UI Action we are defining 3 additional parameters:

 

    var srcSysId = g_form.getUniqueValue();
    var param1 = '^u_copy_to_prod=true';
    var param2 = '^u_install_type=1';   // indicates the environment; 1 is production, 3 is QA
    var param3 = '^u_related_change='+srcSysId;
 

Then we are passing those parameters to sysparm_query as follows:

 

    var ga = new GlideAjax('ChangeUtils');
    ga.addParam('sysparm_name', 'getChangeQueryParams');
    ga.addParam('sysparm_src_sysid', srcSysId);
    ga.setWantSessionMessages(true);
    ga.getXMLAnswer(function (queryParam) {
        if (queryParam) {

                   ...

               addParam(form, 'sysparm_query', queryParam + param1 + param2 + param3);

 

In our Development environment we are now seeing the following behavior for Copy To Production:

  • Normal Change - environment not set to Production but copy_to_prod and related_change appear to be set correctly in the newly created change; the environment in the newly created change remains QA
  • Standard Change - environment not set to Production but copy_to_prod and related_change appear to be set correctly; the environment in the newly created change remains QA
  • Emergency Change - environment set to Production and related_change is set correctly but copy_to_prod is not

It appears that ServiceNow made changes to script include ChangeUtilsSNC in Xanadu Patch 6 - specifically to function _getRecordValuesAsEncodedQuery.

 

Has anyone else run into this issue in Xanadu Patch 6?

 

How can field values be adjusted when copying a change?

 

Thank you

 
4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@mah1 

did you debug and see where it fails?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

I have not.

@mah1 

please debug

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Sorry, but I'm not exactly sure what to debug. I suspect the issue is in function _getRecordValuesAsEncodedQuery in script include ChangeUtilsSNC.