Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Answered

Dealing With Product Bundles In Plugin

Posted on by 125

Hi

I have a plugin registered against opportunity product on create and on update. This works fine. However it errors if the user adds a bundle. So I have attempted to exit the plugin at the earliest opportunity if the product being added is a bundle. However I am now getting a general error saying

Try this action again. If the problem continues, check the Microsoft Dynamics 365 Community for solutions or contact your organization's Microsoft Dynamics 365

and the bundle is not saving. If I run the code through the debugger it looks to be returning as intended if the product is a bundle. Anyone know what is going on here?

Code snippet below.

                if (context.PostEntityImages.ContainsKey("PostImage"))
                {
                    postImage = (Entity)context.PostEntityImages["PostImage"];
                    product = postImage.GetAttributeValue<EntityReference>("productid");
                    if (product.Name.Contains("BUNDLE"))
                    {
                        return;
                    }

                }

  • Verified answer
    jonfarmer4999 Profile Picture
    jonfarmer4999 125 on at
    RE: Dealing With Product Bundles In Plugin

    Just found I need to throw an InvalidPluginExecutionException instead of returning. Bundle adds without  error now.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans