web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Create an OpportunityProduct record as part of a Product Bundle

(0) ShareShare
ReportReport
Posted on by 895

Hi,

I'm trying to create an OpportunityProduct record that is the child of a OpportunityProduct of the type Bundle. The OpportunityProduct is created perfectly fine with all it's associations to the parent Bundle and parent ProductAssociation. However, it seems impossible to set the ProductTypeCode field to the value "Optional Bundle Product". It stays at the default of Product.

I also tried to modify the value of the field with Scribe but that didn't work either. 

Anyone an idea?

My code:

                            Entity newOpportunityProduct = new Entity("opportunityproduct");
                            newOpportunityProduct["opportunityid"] = opportunity;
                            newOpportunityProduct["parentbundleid"] = opportunityProductBundel.Id;
                            newOpportunityProduct["productid"] = product2;
                            newOpportunityProduct["uomid"] = uom;
                            newOpportunityProduct["quantity"] = associatedProduct["quantity"];
                            newOpportunityProduct["productassociationid"] = associatedProduct.Id;
                            if (associatedProduct.GetAttributeValue<OptionSetValue>("productisrequired").Value == 0)
                            {
                                newOpportunityProduct["producttypecode"] = new OptionSetValue(4);
                            } else
                            {
                                newOpportunityProduct["producttypecode"] = new OptionSetValue(3);
                            }
                            service.Create(newOpportunityProduct);


*This post is locked for comments

I have the same question (0)
  • Inogic Profile Picture
    764 on at

    This producttypecode field is not valid for update i.e. “IsValidForUpdate = False”  in Opportunity line/Quote line/ Order Line/Invoice Line product for more details you can refer entity metadata in SDK.

    Working :

    When you create a  product bundle and add a product to it, there is “Required”  field on the form where you have to select “Required” or ”Optional” option for the product.

    For e.g.

    If you have created “Test bundle” bundle with “12-inch security monitor” as “Required”, “365 LM Security” as “Optional” products in it.

    When you add this “Test bundle” on opportunity line then “365 LM Security” product type will be shown as “Optional Bundle Product” but if you add same product individual its Product type will be “Required”.

    producttypecode.jpg

    This is an OOB functionality of Dynamics.

     

    If this answered your question, please make sure to Mark this as an Answer.

    Thanks!

  • Marc G. Profile Picture
    895 on at

    Hi Inogic,

    I know how the Product Bundle functionality works. I was just curious if it would be possible to create an OpportunityProduct with the Product Type set to Required Bundle Product or Optional Bundle Product. So it seems this is impossible to I have to figure out another way to get this working.

    Thanks,

    Marc

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans