Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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

@rahuls2319 

Did you mistakenly marked your own response as correct?

The approach I shared should work fine as well.

Would you mind marking appropriate response as correct?

Regards
Ankur

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