How to clone a service request (or an incident) and attach all the related data to that clone?

wei2
Tera Contributor

Just wonder if anyone has the answer for the following requirement/ask:

Goal:

Clone existing records (mostly service requests or incidents) along with all the related data attached to them, and then transfer the cloned records to another "non-ServiceNow" systems via web services.

Why do you need to clone existing records?

Due to limited time and resources, the other "non-ServiceNow" systems can only accept "new" records during creation.

Many thanks in advance!

14 REPLIES 14

wei2
Tera Contributor

Just attached the xml for this UI action downloaded from this share url: https://share.servicenow.com/app.do#/detailV2/3aa3eee72bf5e1004a1e976be8da1590/overview


randrews
Tera Guru

if y ou build a list view of the table that just shows the records you want to import... and then right click.. on the header and choose export xml.. y ou should be able to import that into another instance...



the only real issue i see is this type of expot isn't going to include anything in related lists.. but for incident/requests should work fine.


wei2
Tera Contributor

Just a little clarification: the goal is to perform the following via UI Action on the current record (incident, request, etc.):


  1. Export itself to one pdf file (in default view, including all field updates and all notes from journal fields, plus all field updates and all notes from journal fields from all of its related records, such as request+request item+catalog task; incident+related incidents/problems/changes. etc.)
  2. Attach the pdf to itself
  3. Clone itself to a "net-new" record, including that pdf file
  4. Give user a chance to review/update the "net-new" record, attach new files to it, in order to meet the requirement for the next two steps
  5. Give user a chance to email the "net-new" record (including all attached files)
  6. Export the "net-new" record to a third party system via web services (including all attached files)

sunny13
Giga Expert

Hi ,



Were you able to develop something to fix the issue?


akasharora
Mega Expert

Hi wql, try the below script



//this is something you can write in an UI action or a business rule



current.number = "";


var newIncident = {};


newIncident = current;


//you can change fields such as


newIncident.state = 0;


newIncident.opened_at = new GlideDateTime();


var sysId = newIncident.insert();


gs.addInfoMessage("Incident "+newIncident.number + " created");


action.setRedirectURL(newIncident);