The CreatorCon Call for Content is officially open! Get started here.

URL Redirection getURLForTask(current, 'rfc'));

imran rasheed
Tera Contributor

Can someone brief what this particular UI Action code does:

action.setRedirectURL(new StdChangeUtils().getURLForTask(current, 'rfc'));

This is being used to create standard change from an Incident. And it redirects to the below page.

I want this UI Action to re-direct to standard change catalog as highlighted rather than to "Standard change catalog->standard change" as it is right now.

find_real_file.png

1 ACCEPTED SOLUTION

Hi @imran rasheed & @Sai Kumar 

Couple of things to note here:

1) OOB when a user click on Standard Change from Incident form, user are redirected to a page as below:

Service Catalog--> Standard Changes where Standard Change is a category and Service Catalog is a record defined under Catalog list menu.

find_real_file.png

Looks like there is a customization at your end where Standard change catalog is added to your instance. But for a solution what you are looking for you need to override the OOB Script include which is a protected one as per steps below:

1) Navigate to Script Include module and open the Script Include named as "StdChangeUtils". Link for the Script Include below:

https://instance.service-now.com/nav_to.do?uri=sys_script_include.do?sys_id=3f894542ffb00200b18affffffffff79

Replace "instance' with your instance name.

Now you need to define the same function below which is getting called in the UI action as mentioned below:

 getURLForTask: function(record, field) {
        if (!record || !field)
            return;

        var target = 'table:' + record.getTableName();
        target += ';sysid:' + record.getUniqueValue();
        target += ';field:' + field;

        var gu = new GlideURL('catalog_home.do');
        gu.set('v', '1');
        gu.set('sysparm_catalog', 'e0d08b13c3330100c8b837659bba8fb4'); // Replace the sys id with your Standard Change Catalog Sys id
        gu.set('sysparm_catalog_view', 'catalog_default');
        gu.set('sysparm_processing_hint', target);
		gu.set('sysparm_cartless', 'true');

        return gu.toString();
    },

 Note: Instead o hard coding a sys id above, please create a System Property and then call the same in script above as a good practice.

For creating System Property, Navigate to "sys_properties.LIST" from Application navigator menu.

Create a property and then call it in above script using the syntax "gs.getProperty('Property Name');

So now when you click on Standard Change button from Incident you will be redirected to the page you want. This works for me in my PDI

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

View solution in original post

7 REPLIES 7

Sai Kumar B
Mega Sage

@imran rasheed 

1.) Check if you have the below 'Standard change property' in std_change_properties table

2.) Check if you have any Standard change templates in your instance

Standard change catalog -> All Templates

find_real_file.png

Hi Sai,

 

Yes it is there.

Sai Kumar B
Mega Sage

@shloke04 @Ankur Bawiskar @Anil Lande @Amit Gujarathi Everything seems right to me, Could you please help with this?

Hi @imran rasheed & @Sai Kumar 

Couple of things to note here:

1) OOB when a user click on Standard Change from Incident form, user are redirected to a page as below:

Service Catalog--> Standard Changes where Standard Change is a category and Service Catalog is a record defined under Catalog list menu.

find_real_file.png

Looks like there is a customization at your end where Standard change catalog is added to your instance. But for a solution what you are looking for you need to override the OOB Script include which is a protected one as per steps below:

1) Navigate to Script Include module and open the Script Include named as "StdChangeUtils". Link for the Script Include below:

https://instance.service-now.com/nav_to.do?uri=sys_script_include.do?sys_id=3f894542ffb00200b18affffffffff79

Replace "instance' with your instance name.

Now you need to define the same function below which is getting called in the UI action as mentioned below:

 getURLForTask: function(record, field) {
        if (!record || !field)
            return;

        var target = 'table:' + record.getTableName();
        target += ';sysid:' + record.getUniqueValue();
        target += ';field:' + field;

        var gu = new GlideURL('catalog_home.do');
        gu.set('v', '1');
        gu.set('sysparm_catalog', 'e0d08b13c3330100c8b837659bba8fb4'); // Replace the sys id with your Standard Change Catalog Sys id
        gu.set('sysparm_catalog_view', 'catalog_default');
        gu.set('sysparm_processing_hint', target);
		gu.set('sysparm_cartless', 'true');

        return gu.toString();
    },

 Note: Instead o hard coding a sys id above, please create a System Property and then call the same in script above as a good practice.

For creating System Property, Navigate to "sys_properties.LIST" from Application navigator menu.

Create a property and then call it in above script using the syntax "gs.getProperty('Property Name');

So now when you click on Standard Change button from Incident you will be redirected to the page you want. This works for me in my PDI

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke