- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2021 11:19 AM
Hello,
we have a requirement, can someone help me with the code.
We have a catalog item, and there is a rich text HTML variable that is pointing to a record producer
when the user clicks on that link the record producer will open in a new tab ,when the Record producer is submitted it should check if it is coming from that catalog item then it should set the Assignment group to xyz on submit of that RC
Below is the link
https://servicenowguru.com/scripting/client-scripts-scripting/parse-url-parameters-client-script/
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2021 10:12 AM
You can also consider below approach.
- First set the parameter in URL as tony suggested.
- If you have not any variable over record producer form which is going to hold that URL parameter value then you can write below code in record producer "script" field to set that group into assignment group field.
eg:
var grp = gs.action.getGlideURI().getMap().get('sysparm_grp'); // sysparm_grp is url paramter
current.assignment_group.setDisplayValue(grp);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2021 06:51 PM
Hi, as the link you supplied indicates you can pass a parameter to via a url using this basic format &sysparm_yourParmName
eg var myParm = '&sysparm_incident=' + current.sys_id;
var url = 'com.glideapp.servicecatalog_cat_item_view.do?&sysparm_id=sysidForYourRecordProducer' + myParm;
and then use an onload client script to extract the value.
I found forum posts that indicated the SNCGuru script needed to be updated due to SNC platform changes,
and this is the solution I use.
– I cannot recall where I found it, so can't give credit.
var testParm = getParmVal('sysparm_yourParmName’);
function getParmVal(name) {
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(location.href);
if (results == null) {
return "";
} else {
return unescape(results[1]);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2021 07:29 PM
Thanks, Tony for the reply, can you please help me with what should the rich text URL need to be?
I am a bit lost here,
On the catalog item, we have this variable, what is the URL I need to use here?
As of now, This is the link record that is being used below is the link to the record producer which will create an inquiry.
https://abcdev.service-now.com/com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=89ffc9fc1b11fc906ad8ec65604bcbd0
below is the catalog item URL
https://abcdev.service-now.com/nav_to.do?uri=%2Fcom.glideapp.servicecatalog_cat_item_view.do%3Fv%3D1%26sysparm_id%3D7ca1b97c1bd5fc906ad8ec65604bcbe5
when the link is clicked the record producer will be opened and after submitting the inquiry we need to check if that record producer is opened from the catalog item then set the assignement group to "servicenow_admins"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2021 10:12 AM
You can also consider below approach.
- First set the parameter in URL as tony suggested.
- If you have not any variable over record producer form which is going to hold that URL parameter value then you can write below code in record producer "script" field to set that group into assignment group field.
eg:
var grp = gs.action.getGlideURI().getMap().get('sysparm_grp'); // sysparm_grp is url paramter
current.assignment_group.setDisplayValue(grp);