unable to send attachment from the record producer to target record while updating
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 02:15 AM
Hello,
I am working on a requirement where i use a record producer to both creating and updating a record in custom table.
When creating a record , record producer is sending attachment correctly, But the problem is , while updating the same record , the attachment is not getting added along with old attachment in the target record that is being updated.
Any help on how to achieve this?
I am using record producer script for updating the record.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 02:30 AM
Hello @Rohith Sureshk1 ,
Please post your script here so I can suggest needed changes.
Thank you!!
Dnyaneshwaree Satpute
Tera Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 02:44 AM - edited 06-12-2024 02:44 AM
//gliderecord script:
this is the code, here i am updating a record. i want to add any new attachment added while updating record
if(producer.action = "update_record"){ //user can choose if they want to update/create a record
var gr_custom = new GlideRecord("custom_table");
gr_custom .addQuery("sys_id" , producer.selected_record) //selected record contains the sysid of target record we wanna update
gr_custom .query();
if(gr_custom.next()){
gr_custom.begin_date = producer.start_date;
gr_custom .description = producer.label+producer.additional_requirement;
gr_custom.update();
current.setAbortAction(true);
}
}
else{
gs.addInfoMessage("New Record has been created");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 03:05 AM
@Ankur Bawiskar Any idea on this requirement? Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 03:08 AM
you are aborting in update operation so try getting the sys_attachment record associated to this record producer
if you get that then you can copy to target record
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader