- 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 06:16 AM
//Here you go. This case would apply if you need it for one request. //As per your use case, add the fields which needs to be copied. //If required to copy attachment from item/sc_task table add more attachment statements. var req=new GlideRecord('sc_request'); req.addQuery('number','REQ0010013'); req.query(); if(req.next()) { var req1= new GlideRecord('sc_request'); req1.initialize(); req1.number= "REQ0010055"; req1.insert(); var req2= new GlideRecord('sc_req_item'); req2.intialize(); req2.number= "RITM0010055"; req2.request=req1.sys_id; req2.insert(); var req3= new GlideRecord('sc_task'); req3.initialize(); req3.number= "TASK0010055"; req3.request_item=req2.sys_id; req3.insert(); GlideSysAttachment.copy('sc_request', req.sys_id , 'sc_request', req1.sys_id); } Hope it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2016 05:23 AM
This should give you a good starting point - the script also copies attachments:
'Copy' UI action for Change requests (Part 2!)
Please feel free to connect, follow, mark helpful, like, endorse.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2016 08:45 PM
Thanks for evryone
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2016 12:16 AM
Hi Everyone,
Can any one guide us how to display the duplicate ticket number in the original ticket so that user can understand which is the duplicate one & viceversa?
Thanks,
Sujitha