Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Copy Attachment UI Action

matthew_smith
Kilo Explorer

HI,

I am trying to create a UI Action that takes the info from a Facilities Request and copies that into an incident. I have most of it working except the copying of any attachments, what am I doing wrong?

I am a complete novice at this and have completely hashed this together!!

Any help is most appreciated!

Matt

var fac = new GlideRecord("incident");

GlideSysAttachment.copy('facilities_request', current.sys.id, 'incident', current.sys_id);

fac.short_description = "Created from Facitlities Record " + current.number + ": " + current.short_description;

fac.caller_id = current.opened_for;

var sysID = fac.insert();

current.u_reference = sysID;

var mySysID = current.update();

gs.addInfoMessage("Incident " + fac.number + " created for this Facilities Record");

action.setRedirectURL(facilities_request);

action.setReturnURL(current);

1 ACCEPTED SOLUTION

Hi Matt,



Updated the script. Can you copy my script above again and try it now .


Basically there was mistake in current.sys.id and it should be current.sys_id


View solution in original post

7 REPLIES 7

Hi Matt,



Updated the script. Can you copy my script above again and try it now .


Basically there was mistake in current.sys.id and it should be current.sys_id


perfect- works like a treat! thanks you so much for your help!


Great


I am glad I can be helpful to you