Copying an attachment from a Change to the Approval Record

andrewdunn
Giga Expert

Hi Community - looking for some assistance please.

I want to be able to copy attachments from a change record to the approval record so that it is sent with the approval email. I have a copy attachment business rule from Call to Incident which works but cannot get this one working as expected.

What I currently have:

  • Business Rule: Add Attachments to Change Approval
    • Table: Change Request [change_request]
    • When to run: After Insert or Update
    • Condition: current.approval.changesTo('requested')
    • Script: GlideSysAttachment.copy('change_request', current.sys_id, 'sysapproval_approver', current.sysapproval.sys_id);

  • Notification email: Change Approval Request
    • Table: Approval [sysapproval_approver]
    • What it Will Contain: Include Attachments ticked

If I manually add an attachment to an approval record and then resend all is good. I just cannot get the attachment to the sysapproval record and I believe it will be a syntax issue

Any suggestions much appreciated

Cheers

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee
ServiceNow Employee

I think your script doesn't work because you can't dot walk from the change request to the approval, but you can dot walk from the approval to the change. I would change this to run in an insert business rule on the approval table when the approval is related to change request.


View solution in original post

2 REPLIES 2

Brad Tilton
ServiceNow Employee
ServiceNow Employee

I think your script doesn't work because you can't dot walk from the change request to the approval, but you can dot walk from the approval to the change. I would change this to run in an insert business rule on the approval table when the approval is related to change request.


andrewdunn
Giga Expert

Thanks Brad - absolutely brilliant - works a treat


For others changed as follows:


Business Rule: Add Attachments to Change Approval


  • Table: Approval [sysapproval_approver]
  • When to run: Async Insert
  • Condition: LEAVE BLANK
  • Script: GlideSysAttachment.copy('change_request', current.sysapproval.sys_id, 'sysapproval_approver', current.sys_id);