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
Wayne_ClarkWayne_Clark 

Products with Custom Object

Hello,

 

Is there anyway to add Products to a custom object like it is with the Opportunity? 

 

Thanks!

EnthEnth

Yes - kind of. You can add a lookup to the product table, if you want multiple products then you need to create a junction object such as MyCustomObjectLineItem and put the lookup field on that.  

 

If you want price information then you need to do a but more work in Apex as you can't have a lookup to the PriceBookEntry table which is what OpportunityLineItems uses to relate to Products.

Wayne_ClarkWayne_Clark

Thanks Enth,

 

Would it be possible to mimic the Add Product functionality with Apex? 

 

Is it possible to create a custom button that would direct the user to a page where they could select the products just like when you add products to the opportunities and quote line items?

sfdcfoxsfdcfox

I have personally done this, and the Quote app from the AppExchange does something similar to this as well. You should be able to find many resources on the subject.

Wayne_ClarkWayne_Clark

Hi sfdcfox,

 

I was wondering if you could point me in the right direction with this, I've searched through the boards and have found similar needs, but no real solution.  I also tried the apps on the appexchange, but they are managed packages and would not let me view the code. Thanks.