Copying information from a case to a problem, change and incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2018 03:40 AM
Hello all
I am new to servcenow i am working through my implementation of stories.
I have been trying to copy information from a case through to a problem, change and incident.
I have managed to do this for incident by changing the ui action for new incident to include this script.
uri.set('sys_id', '-1');
path = checkWizard(uri, path);
if (!gs.nil(parent) && parent.state !=3 && parent.sys_class_name=="sn_customerservice_case"){
var queryStringArray = [];
queryStringArray.push("caller_id="+parent.contact);
queryStringArray.push("company="+parent.account);
queryStringArray.push("short_description="+parent.short_description);
queryStringArray.push("description="+parent.description);
queryStringArray.push("impact="+parent.impact);
queryStringArray.push("urgency="+parent.urgency);
queryStringArray.push("priority="+parent.priority);
queryStringArray.push("cmdb_ci="+parent.priority);
queryStringArray.push("location="+parent.location);
queryStringArray.push("short_description="+parent.short_description);
uri.set("sysparm_query",queryStringArray.join("^"));
}
I have been pulling my hair out trying to do the same for problem and change.
and anyone advise where the new button script's are for problem and change.
thanks
Jack
- Labels:
-
Customer Service Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2018 04:56 AM
Hello,
You can Create UI Action on Case Table -
Name: Create change
Form button: True (Or Anything)
Table: Case
Condition: gs.hasRole(“itil”) && current.isValidRecord()
Script:
var CaseID = current.sys_id.toString();
var newChange = new GlideRecord('change_request');
newChange.initialize();
newChange.short_description = current.short_description;
newChange.requested_by = current.requested_by;
FIELDS YOU WANT TO COPY
newChange.insert();
//Copy attachments for this change
if (typeof GlideSysAttachment != 'undefined')
GlideSysAttachment.copy('case', CaseID, 'change_request', newChange.sys_id);
else
Packages.com.glide.ui.SysAttachment.copy('case', CaseID, 'change_request', newChange.sys_id);
gs.addInfoMessage('Change ticket ' + newChange.number + ' created.')
action.setRedirectURL(newChange);
Like above you create for INCIDENT and PROBLEM as Well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2018 05:40 AM
thanks this works but is their a way not to insert it straight away and have the case agent review the information before it is inserted in to the database?
thanks
Jack