Prepopulate Service portal variables when redirected from Incident form via Related Link

rahuls2319
Tera Expert

Hello all,

I am trying to populate fields from the incident where I have 'related link' to Service Portal page. The Service portal page has a reference to the task field where I am trying to populate the Incident ID.

 

So far, I have tried to embed incident record sys_id in the URL and also created 'onLoad' client script but it doesn't work (Followed this approach as mentioned here -  https://community.servicenow.com/community?id=community_blog&sys_id=596dea29dbd0dbc01dcaf3231f96190b).

 

 

 

 

find_real_file.png

 

Catalog variable where the 'Incident ID' is required to be populated

find_real_file.png

 

UI Action - On the Incident table

find_real_file.png

 

OnLoad Client Script (catalog client script)

 

find_real_file.png

 

Any help is greatly appreciated! Let me know in case any further details are required.

 

Thanks,

Rahul

1 ACCEPTED SOLUTION

Yeah I was able to solve it using the following steps :

 

1. Had forgot to uncheck the "Isolate script" on the catalog client script, so unchecked the option

2. Had to update the URL and replace '&' with '%26' after which I was able to get record sys_id in the URL

 

Updated UI action looks like below :-

 

function goToSCat() {
var recordID = g_form.getUniqueValue();
var tmpURL = '/nav_to.do?uri=com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=338aa285dbe9815051df8a1705961930' + '%26sysparm_number=' + recordID;
g_navigation.openPopup(tmpURL);
}

 

find_real_file.png

 

 

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

line 10 in UI action should be this

var recordID = current.getUniqueValue();

also update the parameter name in UI action

'&sysparm_number=' + recordID;

Regards
Ankur

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

Hi Ankur,

 

Thanks for pointing it out, updated the code but still the redirect URL doesn't seem to contain the 'sysparam_number' variable. The field on the catalog form is also not populated

 

find_real_file.png

 

find_real_file.png

 

 

Hi,

Is it redirecting correctly?

In the URL did you check the sys_id is set to that parameter?

Did you alert the URL in client script?

Regards
Ankur

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

Yeah I was able to solve it using the following steps :

 

1. Had forgot to uncheck the "Isolate script" on the catalog client script, so unchecked the option

2. Had to update the URL and replace '&' with '%26' after which I was able to get record sys_id in the URL

 

Updated UI action looks like below :-

 

function goToSCat() {
var recordID = g_form.getUniqueValue();
var tmpURL = '/nav_to.do?uri=com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=338aa285dbe9815051df8a1705961930' + '%26sysparm_number=' + recordID;
g_navigation.openPopup(tmpURL);
}

 

find_real_file.png