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

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

HTML Code in InvalidPluginExecutionException Message on Connection Form

(0) ShareShare
ReportReport
Posted on by 172

Hi everybody,

I hope you are well. I have an Dynamics 365 9.0.18.12 and have the Problem, that the Message for InvalidPluginExecutionException contains only on the connection Form HTLM Code in the error Message.

I registered the same Plugin on the contact Form and the message is right. See below picture

pastedimage1599849101768v1.png

Error Message in Contact:

pastedimage1599849197123v2.png

Error Message in Connection:

pastedimage1599849278805v3.png

My Code:

 

if (context.InputParameters.Contains("Target") &&
                context.InputParameters["Target"] is Entity)
            {
                // Obtain the target entity from the input parameters.  
                Entity entity = (Entity)context.InputParameters["Target"];

                // Obtain the organization service reference which you will need for  
                // web service calls.  
                IOrganizationServiceFactory serviceFactory =
                    (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
                IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

                try
                {
                    var owner = entity.GetAttributeValue("ownerid");
                    if (owner.LogicalName == "systemuser")
                    {
                        throw new InvalidPluginExecutionException(OperationStatus.Canceled);
                    }
                } catch(InvalidPluginExecutionException ex)
                {
                    throw new InvalidPluginExecutionException("Heute war ein guter Tag.", ex);
                }
            }

Anybody an Idea how can i fix it?

Thanks for help.

I have the same question (0)
  • Suggested answer
    Elie.Mouawad Profile Picture
    9 on at
    HTML Code in InvalidPluginExecutionException Message on Connection Form
    This way will work:
     
    throw new InvalidPluginExecutionException("Heute\u00A0war\u00A0ein\u00A0guter\u00A0Tag.");
     
  • Daniel Schneider Profile Picture
    172 on at
    RE: HTML Code in InvalidPluginExecutionException Message on Connection Form

    Hi Bipin Kumar,

    thanks for your answer. Do I need a productiv lizenz? At the moment I use trail version for OnPremise.

    Thanks for help...

  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at
    RE: HTML Code in InvalidPluginExecutionException Message on Connection Form

    Hi,

    You Should log support ticket with mirosoft to check this issue.

    admin.powerplatform.com/support

    Please mark my answer verified if i were helpful

  • Daniel Schneider Profile Picture
    172 on at
    RE: HTML Code in InvalidPluginExecutionException Message on Connection Form

    Hi all,

    I have need Information. I created an App in 9.0.2.20 CRM Version and in Contact and Connection and the message is displayed correctly. But  only in Unified Interface. Hmm now anybody an idea?

    Thanks for help...

  • Daniel Schneider Profile Picture
    172 on at
    RE: HTML Code in InvalidPluginExecutionException Message on Connection Form

    Any ideas?

  • Daniel Schneider Profile Picture
    172 on at
    RE: HTML Code in InvalidPluginExecutionException Message on Connection Form

    Hi Naveen,

    thanks for your Solution but it doesn´t work. See below...

    Contact Form:

    pastedimage1599977674784v1.png

    Connection Form:

    pastedimage1599977753023v2.png

    It is right that the contact and connection forms are different? Because it looks so for me. In Contact you have no WebApi Query but in Connection it is so. Thats sounds for me that we make an retrieve and the response in the InvalidPluginExecutionException is not formated. I don´t know if its right. But now i have no more ideas.

    Thanks Naveen =)

  • Naveen Ganeshe Profile Picture
    3,397 User Group Leader on at
    RE: HTML Code in InvalidPluginExecutionException Message on Connection Form

    Hi Daniel,

    can you try this one?

    try

                   {

                       var owner = entity.GetAttributeValue<EntityReference>("ownerid");

                       if (owner.LogicalName == "systemuser")

                       {

                           throw new InvalidPluginExecutionException(OperationStatus.Canceled, "yourMessage");

                       }

                   } catch(InvalidPluginExecutionException ex)

                   {

                       throw new InvalidPluginExecutionException("Heute war ein guter Tag." + ex.Message);

                   }

  • Daniel Schneider Profile Picture
    172 on at
    RE: HTML Code in InvalidPluginExecutionException Message on Connection Form

    I don´t know if i understand you right but i use it like following:

    if(owner.LogicalName == "systemuser"){

    throw new InvalidPluginExecutionException(OperationStatus.Cancel, "yourMessage");

    }

    Can you please describe what you mean?

  • Community Member Profile Picture
    on at
    RE: HTML Code in InvalidPluginExecutionException Message on Connection Form

    There are some plugins InvaligPluginException based on some conditions to stop the Email being sent. But user should not be shown the Business process dialogue. The code seems to do exact same thing but for our situation, this is not working. Can you please give some idea on how to get saveErrorResponse and stop the Dialogue being displayed.

  • Daniel Schneider Profile Picture
    172 on at
    RE: HTML Code in InvalidPluginExecutionException Message on Connection Form

    Hi Syed,

    thanks for your answer. Here is the result of your solution.

    Contact Form:

    pastedimage1599904554034v1.png

    Connection Form:

    pastedimage1599904631086v2.png

    Same issue =(. What I don´t know is why it is only on connections... I tried different SDK Versions from 8.0.0 to the latest in my Plugin. In CRM 8.2 OnPremise in Connection these issue is not there.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 258

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 164

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 121 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans