- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2016 04:13 AM
Is there any way to easily duplicate an service request REQ ticket, including the attachments?
We are using helsinki.
Can any one help us on this?
Thanks,
Sujitha
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2016 05:22 AM
Hi Sujitha,
Try using Ui action:
Name:Duplicate Request
Action name:duplicate_request //this name is using in script so if u change this name then u need to change in script also
Show Update: True
Client:True
Form Button:True
Onclick: runClientCode()
Script:
function runClientCode(){
var answer1 = confirm("Are you sure you want to create duplicate request? ");
if (answer1 == false) {
return false;
}
gsftSubmit(null, g_form.getFormElement(), 'duplicate_request');
}
if(typeof window == 'undefined')
runBusRuleCode();
function runBusRuleCode(){
var sys_id=current.sys_id;
var req = new GlideRecord("sc_request");
req.initialize();
req.short_description = current.short_description;
req.description='Dupplicate Requset' ;
req.requested_for=current.requested_for;
//add more action
req.insert();
var gl=new GlideRecord("sys_attachment");
gl.addQuery('table_sys_id',sys_id);
gl.query();
while(gl.next()){
var table=gl.table_name;
var File=gl.file_name;
var content=gl.content_type;
var attach=new GlideRecord('sys_attachment');
attach.intialize();
attach.table_name=table;
attach.file_name=File;
attach.content_type=content;
attach.table_sys_id=req.sys_id;
attach.insert();
}
//current.deleteRecord();
gs.addInfoMessage("Request " + req.number + " created");
action.setRedirectURL(req);
action.setReturnURL(current);
}
Let me know if it resolves your issue.
PS:Mark helpful or correct if this solves your issue.
Thanks,
farukh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2016 04:39 AM
you need to create a background script for inserting a new record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2016 04:50 AM
Hi Akhil,
Can you please help me with the script?
Thanks,
Sujitha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2016 05:22 AM
Hi Sujitha,
Try using Ui action:
Name:Duplicate Request
Action name:duplicate_request //this name is using in script so if u change this name then u need to change in script also
Show Update: True
Client:True
Form Button:True
Onclick: runClientCode()
Script:
function runClientCode(){
var answer1 = confirm("Are you sure you want to create duplicate request? ");
if (answer1 == false) {
return false;
}
gsftSubmit(null, g_form.getFormElement(), 'duplicate_request');
}
if(typeof window == 'undefined')
runBusRuleCode();
function runBusRuleCode(){
var sys_id=current.sys_id;
var req = new GlideRecord("sc_request");
req.initialize();
req.short_description = current.short_description;
req.description='Dupplicate Requset' ;
req.requested_for=current.requested_for;
//add more action
req.insert();
var gl=new GlideRecord("sys_attachment");
gl.addQuery('table_sys_id',sys_id);
gl.query();
while(gl.next()){
var table=gl.table_name;
var File=gl.file_name;
var content=gl.content_type;
var attach=new GlideRecord('sys_attachment');
attach.intialize();
attach.table_name=table;
attach.file_name=File;
attach.content_type=content;
attach.table_sys_id=req.sys_id;
attach.insert();
}
//current.deleteRecord();
gs.addInfoMessage("Request " + req.number + " created");
action.setRedirectURL(req);
action.setReturnURL(current);
}
Let me know if it resolves your issue.
PS:Mark helpful or correct if this solves your issue.
Thanks,
farukh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2016 08:40 AM
Hi,
But in this code what changes should I make so that I get the attachments loaded succesfully