How to copy attachment from one record to another record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2017 03:07 AM
Hi Everyone,
I have a requirement, the scenario is that upon insert the attachment in the Customer Service application that I have created will automatically copied to the incident record.
the case is that if an agent is about to submit a ticket from the customer service application, once he indentified that this is an incident it will automatically create an incident ticket, I was successful on that part but the problem is that the attachment is not included once the incident record is created. I have this code but it is not working, hope someone can help me.
Business Rule
Table: Customer Service
When to Run: After / Insert
Script:
(function executeRule(current, previous /*null when async*/) {
var ritm = new GlideRecord('x_glti_incident_ma_incident_management_table');
ritm.addQuery('x_glti_customer_se_customer_service_ticket',current.sys_id);
ritm.query();
while(ritm.next()){
GlideSysAttachment.copy('x_glti_customer_se_customer_service', current.sys_id, 'x_glti_incident_ma_incident_management_table', ritm.sys_id);
}
})(current, previous);
Many thanks in advance
- Labels:
-
Scripting and Coding
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2017 05:11 AM
I think so too. I think I need to create a script in the "Script Include" to invoke it in any application scope. hmmmm