🎓 Scenario-Based Question
📎 Use Case: Copy Attachment from One Table to Another
In this example, attachments added to an Incident are automatically copied to a related Problem record via a Business Rule.
Steps to Implement:
- ✅ Create a Problem record in the
problem
table and note its Problem Number. - ✅ On the Incident form, add the Problem related list if missing:
Incident Form > Configure > Related Lists > Add "Problem -> Parent" - ✅ Create an Incident, fill required fields, save, and link the Problem number in the related list.
- ✅ Create a Business Rule on the
incident
table with these settings:- Name: (your choice)
- Before Insert: ☑️
- Advanced: ☑️
Business Rule Script:
(function executeRule(current, previous /*null when async*/) { var prb = new GlideRecord('problem'); prb.addQuery('parent', current.getUniqueValue()); prb.query(); if (prb.next()) { var copyAtt = new GlideSysAttachment(); copyAtt.copy('incident', current.getUniqueValue(), 'problem', prb.getUniqueValue()); } })(current, previous);
Final Steps:
- Save the Business Rule.
- Attach a file to the Incident record you created and update it.
- Navigate to the related Problem record and verify that the attachment is copied there.
🎉 You’ve successfully automated attachment copying between Incident and Problem tables!