
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2019 08:32 AM
I have a requirement to copy and but I do not want to insert the record right away. Instead I want it to copy some of the fields to the new incident but I need to leave some mandatory fields blank. So I would like it to act like someone click create new incident but the only difference is that things like short description, description, etc get copied to the new incident.
Solved! Go to Solution.
- 3,864 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2019 08:52 AM
I found this GURU article I'm trying to follow it. I put in some alert and found that it is calling the function in the client script seems to die after the first line in the function getParamVal. Below is my code to for the UI action and client script.
UI Acation:
createRecord();
function createRecord(){
var shortdesc = current.getValue('short_description');
var desc = current.getValue('description');
var imp = current.getValue('impact');
var urg = current.getValue('urgency');
var ci = current.getValue('cmdb_ci');
var url = 'incident.do' + '?sysparm_shortdescription='+shortdesc+'&sysparm_description='+desc+'&sysparm_impact='+imp+
'&sysparm_urgency='+urg+'&sysparm_cmdbci='+ci;
action.setRedirectURL(url);
}
Client Script:
function onLoad() {
//Populate the variables with the parameters passed in the URL
//Use the 'getParmVal' function below to get the parameter values from the URL
var shortdesc = getParmVal('sysparm_shortdescription');
var desc = getParmVal('sysparm_description');
var imp = getParmVal('sysparm_impact');
var urg = getParmVal ('sysparm_urgency');
var ci = getParmVal('sysparm_cmdbci');
g_form.setValue('short_description', shortdesc);
g_form.setValue('description', desc);
g_form.setValue('impact', imp);
g_form.setValue('urgency', urg);
g_form.setValue('cmdb_ci', ci);
}
function getParmVal(name){
var url = document.URL.parseQuery();
if(url[name]){
return decodeURI(url[name]);
}
else{
return;
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2019 08:52 AM
I found this GURU article I'm trying to follow it. I put in some alert and found that it is calling the function in the client script seems to die after the first line in the function getParamVal. Below is my code to for the UI action and client script.
UI Acation:
createRecord();
function createRecord(){
var shortdesc = current.getValue('short_description');
var desc = current.getValue('description');
var imp = current.getValue('impact');
var urg = current.getValue('urgency');
var ci = current.getValue('cmdb_ci');
var url = 'incident.do' + '?sysparm_shortdescription='+shortdesc+'&sysparm_description='+desc+'&sysparm_impact='+imp+
'&sysparm_urgency='+urg+'&sysparm_cmdbci='+ci;
action.setRedirectURL(url);
}
Client Script:
function onLoad() {
//Populate the variables with the parameters passed in the URL
//Use the 'getParmVal' function below to get the parameter values from the URL
var shortdesc = getParmVal('sysparm_shortdescription');
var desc = getParmVal('sysparm_description');
var imp = getParmVal('sysparm_impact');
var urg = getParmVal ('sysparm_urgency');
var ci = getParmVal('sysparm_cmdbci');
g_form.setValue('short_description', shortdesc);
g_form.setValue('description', desc);
g_form.setValue('impact', imp);
g_form.setValue('urgency', urg);
g_form.setValue('cmdb_ci', ci);
}
function getParmVal(name){
var url = document.URL.parseQuery();
if(url[name]){
return decodeURI(url[name]);
}
else{
return;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2019 10:47 AM
I figured this out, because I'm testing in my personal dev instance which is in London I had to set a field called Isolate script to false on the client script which allowed me to use dom manipulation.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2019 01:38 PM
Would you mind linking to the Guru article you are following?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2019 01:45 PM
I am not using this anymore. As for Kingston I believe there is a copy incident included OOB. This was a temporary. We are now in London so what I created it now disabled.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2020 05:39 AM
Hi Brain;
Is this getParmVal() working for you. For me it is not opening the dynamic URL with field values after click on the copy incident.
Please let me know if it worked for you and what you did?
Thanks
Balaji Prusty