How to override the StdChangeUtilsSNC by using the StdChangeUtils script include

tkh
Kilo Expert

We are configuring the Standard Change Catalog and when creating the Standard change from the template it is creating the wrong change type.  In the StdChangeUtilsSNC script include, line 14 is DEFAULT_CHG_TYPE: 'standard', and we need it to be DEFAULT_CHG_TYPE: 'Standard'.  (with capital S).  So reading up says we can override this using the StdChangeUtils but nothing I have found says where exactly in the script you should put the override.

So far all my efforts have not been successful.  Can someone please just give me a little guidance on where I should add the override and what it should loook like?

 

Below is the script for easy reference:

var StdChangeUtils = Class.create();
StdChangeUtils.prototype = Object.extendsObject(StdChangeUtilsSNC, {
initialize: function(request, responseXML, gc) {
StdChangeUtilsSNC.prototype.initialize.call(this, request, responseXML, gc);
},

/***************************
*
*Add customer changes below
*
****************************/


type: 'StdChangeUtils'
});

1 ACCEPTED SOLUTION

tkh
Kilo Expert

First, thank you everyone who responded.  The time and effort the Community shares is amazing.

Second, early this morning we figured it out and it was a combination of things.  I actually did have the solution correct at one point but the reason it was not working for us is that we were testing using an pre-fix template.  We needed to build and approve a new template, once we did that it worked!

find_real_file.png

Thank you everyone for the help.

View solution in original post

4 REPLIES 4

RavindranKeshav
Giga Expert

Hi,

Based on this thread .. https://community.servicenow.com/community?id=community_question&sys_id=3c1d8b69db9cdbc01dcaf3231f961964&anchor=answer_c2bb4879dbd05fc01dcaf3231f9619ce&view_source=searchResult

I would think this might work:

 

var StdChangeUtils = Class.create();
StdChangeUtils.prototype = Object.extendsObject(StdChangeUtilsSNC, {

initialize: function(request, responseXML, gc) {

StdChangeUtilsSNC.prototype.initialize.call(this, request, responseXML, gc);
this.DEFAULT_CHG_TYPE="Standard";
},

type: 'StdChangeUtils'
});

 

pls try 🙂

David Ramirez
Kilo Guru

I believe Ravindran is correct, however, as mentioned by Fernando Dunn in an old community article, please note that when you override DEFAULT_CHG_TYPE, it only applies when you create a NEW proposal. Existing Standard Change Record Producer (std_change_record_producer) records that were previously created through the approval process already have the previous Type in their (usually hidden and read-only) "Script" field.

Therefore you will need to re-create your standard change templates to use the new change type.

tkh
Kilo Expert

First, thank you everyone who responded.  The time and effort the Community shares is amazing.

Second, early this morning we figured it out and it was a combination of things.  I actually did have the solution correct at one point but the reason it was not working for us is that we were testing using an pre-fix template.  We needed to build and approve a new template, once we did that it worked!

find_real_file.png

Thank you everyone for the help.

tkh
Kilo Expert

To give credit where it is due here is the link to the article that lead us to the answer.  We found the answer buried deep in this article.

https://community.servicenow.com/community?id=community_question&sys_id=3c1d8b69db9cdbc01dcaf3231f961964