1

I'd like to give users the ability to attach files to the Opportunity Product sObject which doesn't inherently support file attachments.

How do I add that ability?

  • I'm not certain what you mean by "Opportunity Product sObject". Are you talking about either the Pricebook2 or perhaps the PricebookEntry sObjects? The Product and Schedule Objects diagram should help you clarify your question. – crmprogdev Jun 25 '15 at 16:00
  • The setup UI called is Opportunity Products (look in Opportunities). The object is actually called OpportunityLineItem, – sberley Jun 25 '15 at 22:18
1

OpportunityLineItem, or OLI as it's commonly referred to, is basically a reference in an Opportunity to a Product2Id that's listed in a Pricebook2 along with discounts and other things that have been applied to get the LineItem Total which is then summed to generate the Opp Amount. There's also info that affects Forcasting. The vast majority of what's in OLI is look-up info from other objects.

If you want to have attachments to OLI, I'd create a custom object that's a child of OLI. Whenever an OLI is deleted, I'd expect that you'd want to also delete the attachments as well. For that reason, I'd create a M-D relationship between OLI and the custom object where OLI is the master and the custom object is the detail.

That way, anything you want to attach to OLI, would be a child of OLI and would automatically be deleted with OLI and associated with the ID of an OLI record as opposed to being in a look-up relationship. That would be my recommendation if you feel you must have attachments to OLI as opposed attaching to the Opportunity instead (or possibly Pricebook2).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.