Skip to content

Commit

Permalink
Might be a bit help for #777
Browse files Browse the repository at this point in the history
  • Loading branch information
rappen committed Sep 6, 2022
1 parent 3bbf61e commit aedad15
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions FetchXmlBuilder/Extensions/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ internal static string ToTypeString(this AttributeMetadata attribute)
{
return string.Empty;
}
if (attribute.AttributeTypeName != null)
if (attribute.AttributeTypeName?.Value != null)
{
return attribute.AttributeTypeName.Value.RemoveEnd("Type");
}
return attribute.AttributeType.ToString();
if (attribute.AttributeType != null)
{
return attribute.AttributeType.ToString();
}
return string.Empty;
}

internal static string TriToString(this CheckState state, string uncheck_check_indterminate)
Expand Down
6 changes: 3 additions & 3 deletions FetchXmlBuilder/Forms/SelectAttributesDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ private void GenerateAllItems(List<AttributeMetadata> attributes, List<string> s
allItems = new List<ListViewItem>();
foreach (var attribute in attributes)
{
var name = attribute.DisplayName.UserLocalizedLabel != null ? attribute.DisplayName.UserLocalizedLabel.Label : attribute.LogicalName;
var name = attribute.DisplayName?.UserLocalizedLabel?.Label ?? attribute.LogicalName;
var item = new ListViewItem(new string[] {
name,
attribute.LogicalName,
attribute.ToTypeString(),
attribute.IsValidForRead.Value.ToString(),
attribute.IsValidForRead.HasValue ? attribute.IsValidForRead.Value.ToString() : "",
attribute.IsValidForGrid.HasValue ? attribute.IsValidForGrid.Value.ToString() : "",
attribute.IsValidForAdvancedFind.Value.ToString(),
attribute.IsRetrievable.Value.ToString()
attribute.IsRetrievable.HasValue ? attribute.IsRetrievable.Value.ToString() : ""
});
item.Name = attribute.LogicalName;
item.Text = name;
Expand Down

0 comments on commit aedad15

Please sign in to comment.