Skip to content

EntityNameType attributes are cast to String instead of OptionSetValue #67

@Aagaard00

Description

@Aagaard00

Describe the bug
If you are working with an entity that has a EntityNameType-attribute for instance ActivityPointer it will crash if you try to access the attribute e.g. "activitytypecode" via the property ActivityTypeCode because it gets the attribute value as a String when it should get it as a OptionSetValue.

To Reproduce
Steps to reproduce the behavior:

  1. Generate context with the ActivityPointer-included
  2. Try to use the ActivityTypeCode property in code e.g. plugin or others

Expected behavior
The code should crash when you try to access the ActivityTypeCode property since it cant cast the OptionSetValue to a String.

Screenshots

Image Image

Environment

  • CRM/D365/CDS version: [e.g. 9.2.26043.00165]
  • Tool version: [e.g. 3.0.1]

Additional context

// Context with casting issue
[AttributeLogicalName("activitytypecode")]
[DisplayName("Aktivitetstype")]
public string ActivityTypeCode {
    get {
        return GetAttributeValue<string>("activitytypecode");
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions