- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2020 12:46 AM
Hi Friends,
I have business rule on update on change rquest,which checks for the check box selected.If check box is selected, it will throw error message with hyperlink.
This hyperlink redirects to some catalog item form.Here i want to set catalog variable with change number.
When i pass current.sys_id in the url which is not working.
I checked in community as well, there they have pass hardcoded sys_id which is working for me but setting dymanic is not working.
Url in the business rule of change request table.
var url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=e826b8c50a0a3c1e019410bb1031d102&sysparm_change= current.sys_id
Here sysparm_id is the sys id of the catalog item which i want to redirect if user clicks on hyperlink
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2020 01:58 AM
Hi Vijay,
I assume since you are transferring the change request sys_id and change request number you must be having some onload client script to fetch value from URL and set it in the variable
var url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=e826b8c50a0a3c1e019410bb1031d102&sysparm_change=' + current.sys_id + '&sysparm_changeNumber=' + current.number;
below is the onload catalog client script which would help you get the change number and set to variable
function onLoad(){
var url = top.location.href;
var changeNumber = new URLSearchParams(url).get("sysparm_changeNumber");
g_form.setValue('variableName',changeNumber);
}
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2020 12:59 AM
Try this,
var sys_id = current.sys_id;
var url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=e826b8c50a0a3c1e019410bb1031d102&sysparm_change='+sys_id;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2020 01:14 AM
Hi Vijay,
You can try below.
var changeis=current.sys_id;//stores sys_id in variable changeis
var url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=e826b8c50a0a3c1e019410bb1031d102&sysparm_change='+changeis;
Just make sure change field on the form where you want to set the Change value is reference field else it will set sys_id of the change.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2020 01:58 AM
Hi Vijay,
I assume since you are transferring the change request sys_id and change request number you must be having some onload client script to fetch value from URL and set it in the variable
var url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=e826b8c50a0a3c1e019410bb1031d102&sysparm_change=' + current.sys_id + '&sysparm_changeNumber=' + current.number;
below is the onload catalog client script which would help you get the change number and set to variable
function onLoad(){
var url = top.location.href;
var changeNumber = new URLSearchParams(url).get("sysparm_changeNumber");
g_form.setValue('variableName',changeNumber);
}
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2020 10:48 PM
Thanks