function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
john8407john8407 

Attachment question

We have a custom object called order that is generated from an opportunity.  If users attach an attachment to an opportunity, is there any way to have that attachment flow over to the order?

Imran MohammedImran Mohammed

If you mean to get  opportunity attachment attached to Order, you can do it by writing a trigger.

In trigger,

1. you have to get parentid of inserted attachment.

2. Query Opportunity object using the parentid.

3. If the query returns opportunity records, create new attachments and set parentid as Order.id for these attachments.

 

In this way you can achieve this.

Let me know if anything is not clear.