Hello Captain,
Ok, excellent explanation.
SO the "Deal" is having relationship to the Opportunity and have field = standard price (the total of the whole Opportunity, correct?)
When you are able to create the Deal with the name of Opportunity and the standard price, you want to make sure that in the newly created Deal, the users can see the Product from the Opportunity that they have created and attached before using the OOTB method.
Actually the user can see the list of the Product through the original opportunity, but you don't want the user to be burdened by clicking "Deal", clicking Opportunity.
Okay, understand if that I captured correctly.
I can recommend three options:
1. You don't create another "Deal" Product line item so you can go by adding the N:1 Relationship from "Opportunity Product" entity to the "Deal"
Then when you create the "Deal" right, you can get the "Deal" is created, then you must create a plugin that triggered on the "Deal" created, in the "Deal" I believe you have all of the Opportunity info, including Opp Unique Id.
So your plugin logic is:
Just retrieve the Opportunity Id from the "Deal", then get the Opportunity ID then you use the Query Expression to retrieve all the related Opportunity Product records, okay? After that you just link the Opportunity Product to the "Deal" just now you created.
Now, in your "Deal" form, just add a subgrid to put the Opportunity Product subgrid.
So the result, you can imagine that the "Deal", when the users came in, they will see the all Products from the Opportunity. It is very easy and convenience for them to see all the Products related without clicking the Opportunity.
But, you might try to block them to not update this because it will affect the whole Opportunity.
If your purpose is to let them edit the Price in the Deal only, not the Opportunity, you might go for option number #2
2. You create another Entity "Deal Product" which will have 3 fields at least: Product, Opportunity (all lookup fields) and the price from the Opportunity Product.
Then you create a plugin to copy the Opportunity Product to this entity.
Do the same plugin concept mentioned in number #1
It might not better than option #1, just to let you know the alternative here.
The pro side here is you don't need any validation to block them to not edit the Product line because it wont affect the real Opportunity.
The Question here is:
"What if the user create an Opportunity, with 5 vehicles, A, B, C, D, and E"
Then you create a new deal.
Can they change the Products? To A, B, X, Y, Z or only selling A and B? or add to A, B, C, D, E, F?
You read my response for first 1, you want to keep track the original Opportunity price or not? If yes, then you go for option number 2, that is duplicate the Opportunity product to store the changes of negotiation through the "Deal".
The advantages for number 1 are you save space, no need to build custom entity anymore, but you cannot see the different between "Deal" and Opportunity Product.
If you go for number 2, it is more flexible for users to adjust the Product + the Price, but you might need to come back to update it back to the Opportunity product right? Because you want to have Quote and Invoice and so on.
So the quote basically will have copy from the Opportunity Products, so if you already fixed everything in the Opportunity you might not need to be headache when generate a quote because it copies them all.
3. My another suggestion is the combination.
But you might need a Quick View Form.
Configure a new quick view form for the Opportunity.
Then from that Quick View form, please put a subgrid, put the Opp Product subgrid, ok.
Then after that you back to the Deal Form and put the Quick view form you created before.
You still need a plugin to copy all the Opportunity product to the Deal Product (number #2 step).
Imagine when the user go to the Deal, they can see the Opportunity Info, including all the Products without clicking the Opportunity.
Actually the best way is N:N (manual intersection) from Opportunity Product and the "Deal" but the Opportunity Product cant have the 1:N Relationship so it wont work.
If I may recommend you, for the price adjusting, and negotiation as well.
Usually my recommendation is using Quote.
So from Opportunity instead of creating "Deal" as the Custom Entity, why you not utilize the Quote as "Deal"?
What kind of information "Deal" has except the Product Line and the Price?
Because it is very easy if you use Quote from the Opportunity, it will inherit everything.
The deal is kind of longer procedure if you can make it done just using Opportunity and Quote.
You can generate as many Quote as you want from an Opportunity before making it Won or Lost.
If you have the "Deal" between Opp and Quote, you need to update the price back to the "Opp" then you create the "Quote" so double job for the users?
Just a thought.
Overall, (I Know it is long message as reply, so you might not reading it all), I recommend you to replace the "Deal" with Quote if your "Deal" is just an entity to store the negotiation price changes.
If you want to have the "Deal" with all of the Product that already created in the Opp process then you want to adjust the price you can go for option #2, but remember you need to have more code in the Plugin.
Hope this helps
Thanks.