Attachments not getting added to newly created request items or incidents
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2024 12:30 AM
Hi Team,
I have implemented functionality to create requests and incidents through data source and transform map triggering an event queue schedule in workflow . This process is initiated as part of bulk creation workflow based on data source(csv file).
Now, I want to copy the attachment to the created requests /incidents . However, I want to exclude the CSV file used for bulk creation form being copied as an attachment.
Please find my script :I have created on after script in transform map for request creation and for incident i directly mapped fields and creating incidents but i want to copy attachments from bulk creation form or request item to newly created incidents
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var cartId = GlideGuid.generate(null);
var sd= source.u_shortdescription;
gs.log("short desc snt"+sd);
var cart = new Cart(cartId);
var item = cart.addItem(gs.getProperty('x.item'));
cart.setVariable(item,'short_description', sd);
var rc = cart.placeOrder();
gs.log( "Number is :" + rc.sys_id);
//var website=new GlideRecord('cmdb_ci_web_site');
var gr = new GlideRecord("sc_req_item");
gr.addQuery("request", rc.sys_id);
gr.query();
if (gr.next()) {
ritmSysId = gr.getUniqueValue();
}
source.sys_target_table - gr.sys_class_name;
source.sys_target_sys_id = ritmSysId;
source.update();
ignore = true;
}
)(source, map, log, target);
Thank you in Advance.
Regards,
Srinath.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2024 03:49 AM
you can copy the file from RITM to data source each time it runs
clear the earlier attachment from data source
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader