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;
}
}
Just found I need to throw an InvalidPluginExecutionException instead of returning. Bundle adds without error now.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156