- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2014 12:55 PM
On a front page I want to be able to have several links to one record producer and pass some of the data in the url so some of the fields can be pre-filled. I've done this with incidents before with the sysparm_query by adding sysparm_query=priority=1^incident_state=3 to the url
But I can't seem to get it to work with record producers. Keep in mind that I'm using custom variables.
Is this possible?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2014 01:24 AM
Use an onLoad Catalog Client Script like the below:
function onLoad() {
var cmdb_ci = getParmVal('sysparm_cmdb_ci');
if (cmdb_ci) {
g_form.setValue('cmdb_ci', cmdb_ci);
}
}
function getParmVal(name) {
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec( window.location.href );
if(results == null){
return "";
}
else{
return unescape(results[1]);
}
}
and you can pass in like:
var params = 'sysparm_cmdb_ci=' + current.sys_id;
var url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=c60ea0806f159500d9c316ff8d3ee400';
action.setRedirectURL(url + '&' + params);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2014 09:36 PM
You can write onLoad script for each record producer.
Use this syntax to get the previous URL : alert(document.referrer);
Based on this URL, you will understand the variables you need to set.Let me know if you have queries.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2014 05:19 AM
I haven't been able to get the alert to trigger. I also attempted putting this in an onLoad event.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2014 05:31 AM
never mind I realize now that I need to put this in the catalog script. Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2014 01:24 AM
Use an onLoad Catalog Client Script like the below:
function onLoad() {
var cmdb_ci = getParmVal('sysparm_cmdb_ci');
if (cmdb_ci) {
g_form.setValue('cmdb_ci', cmdb_ci);
}
}
function getParmVal(name) {
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec( window.location.href );
if(results == null){
return "";
}
else{
return unescape(results[1]);
}
}
and you can pass in like:
var params = 'sysparm_cmdb_ci=' + current.sys_id;
var url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=c60ea0806f159500d9c316ff8d3ee400';
action.setRedirectURL(url + '&' + params);