1

How i can create inventory custom child object by trigger under opportunity, because child object cannot be created for opportunity line item.

inventory will be created for each line item example-product"A" quantity 2, product "B" quantity 3, after closing the opportunity, inventory will be created -A, -A, -B, -B, -B total 5 with other custome fields product price etc

0

Thats a good question, since it's really impossible to create a Lookup realtionship to OLI.

Next best you could do is to create a Lookup- or Master/Detail-Relationship on Opportunity and add an other custom field (e. g. external Id text(30) ) and store the associated OLI id.

But you won't get many features you usually have for relationships. And you might have to query twice all the time with an WHERE filter to match the association.

You might want to reconsider the second requirement, since for very high quantities you can easily end up with a huge number of custom objects. It will work to a point, but may possibly exhaust your storage limits soon. Expect limit issues for quantities > 2k or 10k or 50k. Introduce an If-statement to prevent huge quantities from polluting your database. If that requirement persists you have to write the logic to maintain the right inventory objects - differently for open and closed opps.

  • I have create master detail with opportunity. But how i can create the record as per quantity using trigger? – Sush Mar 4 '15 at 22:51

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.