Skip to content

Commit

Permalink
Handling connected to "wrong" environtment works nicer now
Browse files Browse the repository at this point in the history
  • Loading branch information
rappen committed May 12, 2022
1 parent 98f6379 commit bfbc5df
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions FetchXmlBuilder/FXBMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Windows.Forms;
using XrmToolBox.Extensibility;

Expand Down Expand Up @@ -362,8 +363,20 @@ private void LoadEntityDetailsCompleted(string entityName, EntityMetadata Result
{
if (Error != null)
{
entityShitList.Add(entityName);
ShowErrorDialog(Error, "Load attribute metadata");
if (!entityShitList.Contains(entityName))
{
entityShitList.Add(entityName);
}
if (Error is FaultException<OrganizationServiceFault> srcexc &&
srcexc.Detail is OrganizationServiceFault orgerr &&
orgerr.ErrorCode == -2147220969)
{
SendMessageToStatusBar(this, new XrmToolBox.Extensibility.Args.StatusBarMessageEventArgs($"Entity {entityName} not found in the database."));
}
else
{
ShowErrorDialog(Error, "Load attribute metadata");
}
}
else
{
Expand All @@ -381,7 +394,10 @@ private void LoadEntityDetailsCompleted(string entityName, EntityMetadata Result
}
else
{
entityShitList.Add(entityName);
if (!entityShitList.Contains(entityName))
{
entityShitList.Add(entityName);
}
MessageBox.Show("Metadata not found for entity " + entityName, "Load attribute metadata", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
working = false;
Expand Down

0 comments on commit bfbc5df

Please sign in to comment.