getEntityMetadata (JavaScript API Reference) for Dynamics 365 Channel Integration Framework 2.0

Returns the entity metadata for the specified entity.

Syntax

Microsoft.CIFramework.getEntityMetadata(entityName, attributes).then(successCallback, errorCallback)

Parameters

Name Type Required Description
entityName String Yes The logical name of the entity.
attributes Array of strings No The attributes to get metadata for.

Returns

Type: Object

Description: An object containing the entity metadata information with the following attributes.

Attribute Name Type Description
ActivityTypeMask Number Whether a custom activity should appear in the activity menus in the Web application. 0 indicates that the custom activity doesn't appear; 1 indicates that it does appear.
AutoRouteToOwnerQueue Boolean Indicates whether to automatically move records to the owner’s default queue when a record of this type is created or assigned.
CanEnableSyncToExternalSearchIndex Boolean For internal use only.
CanTriggerWorkflow Boolean Indicates whether the entity can trigger a workflow process.
Description String Description for the entity.
DisplayCollectionName String Plural display name for the entity.
DisplayName String Display name for the entity.
EnforceStateTransitions Boolean Indicates whether the entity will enforce custom state transitions.
EntityColor String The hexadecimal code to represent the color to be used for this entity in the application.
EntitySetName String The name of the Web API entity set for this entity.
HasActivities Boolean Indicates whether activities are associated with this entity.
IsActivity Boolean Indicates whether the entity is an activity.
IsActivityParty Boolean Indicates whether the email messages can be sent to an email address stored in a record of this type.
IsBusinessProcessEnabled Boolean Indicates whether the entity is enabled for business process flows.
IsBPFEntity Boolean Indicates whether the entity is a business process flow entity.
IsChildEntity Boolean Indicates whether the entity is a child entity.
IsConnectionsEnabled Boolean Indicates whether connections are enabled for this entity.
IsCustomEntity Boolean Indicates whether the entity is a custom entity.
IsCustomizable Boolean Indicates whether the entity is customizable.
IsDocumentManagementEnabled Boolean Indicates whether document management is enabled.
IsDocumentRecommendationsEnabled Boolean Indicates whether the document recommendations are enabled.
IsDuplicateDetectionEnabled Boolean Indicates whether duplicate detection is enabled.
IsEnabledForCharts Boolean Indicates whether charts are enabled.
IsImportable Boolean Indicates whether the entity can be imported using the Import Wizard.
IsInteractionCentricEnabled Boolean Indicates the entity is enabled for interactive experience.
IsKnowledgeManagementEnabled Boolean Indicates whether knowledge management is enabled for the entity.
IsMailMergeEnabled Boolean Indicates whether mail merge is enabled for this entity.
IsManaged Boolean Indicates whether the entity is part of a managed solution.
IsOneNoteIntegrationEnabled Boolean Indicates whether OneNote integration is enabled for the entity.
IsOptimisticConcurrencyEnabled Boolean Indicates whether optimistic concurrency is enabled for the entity.
IsQuickCreateEnabled Boolean Indicates whether the entity is enabled for quick create forms.
IsStateModelAware Boolean Indicates whether the entity supports setting custom state transitions.
IsValidForAdvancedFind Boolean Indicates whether the entity is shown in Advanced Find.
IsVisibleInMobileClient Boolean Indicates whether Microsoft Dynamics 365 for tablets users can see data for this entity.
IsEnabledInUnifiedInterface Boolean Indicates whether the entity is enabled for Unified Interface.
LogicalCollectionName String The logical collection name.
LogicalName String The logical name for the entity.
ObjectTypeCode Number The entity type code.
OwnershipType String The ownership type for the entity: "UserOwned" or "OrganizationOwned".
PrimaryIdAttribute String The name of the attribute that is the primary ID for the entity.
PrimaryImageAttribute String The name of the primary image attribute for an entity.
PrimaryNameAttribute String The name of the primary attribute for an entity.
Privileges Array of objects The privilege metadata for the entity where each object contains the following attributes to define the security privilege for access to an entity:
  • CanBeBasic: Boolean. Whether the privilege can be basic access level.
  • CanBeDeep: Boolean. Whether the privilege can be deep access level.
  • CanBeEntityReference: Boolean. Whether the privilege for an external party can be basic access level.
  • CanBeGlobal: Boolean. Whether the privilege can be global access level.
  • CanBeLocal: Boolean. Whether the privilege can be local access level.
  • CanBeParentEntityReference: Boolean. Whether the privilege for an external party can be parent access level.
  • Name: String. The name of the privilege.
  • PrivilegeId: String. The ID of the privilege.
  • PrivilegeType: Number. The type of privilege, which is one of the following:
    • 0: None
    • 1: Create
    • 2: Read
    • 3: Write
    • 4: Delete
    • 5: Assign
    • 6: Share
    • 7: Append
    • 8: AppendTo
Attributes Collection A collection of attribute metadata objects. The object returned depends on the type of attribute metadata.

Attribute metadata for the base type
An object returned with the following properties:

  • AttributeType: Number. Type of an attribute. For a list of attribute type values, see AttributeTypeCode
  • DisplayName: String. Display name for the attribute.
  • EntityLogicalName: String. Logical name of the entity that contains the attribute.
  • LogicalName: String. Logical name for the attribute.

Attribute metadata for the boolean type
An object returned with the following properties in addition to the base attribute metadata type properties:

  • DefaultFormValue: Boolean. Default value for a Boolean option set.
  • OptionSet: Object. Options for the boolean attribute where each option is a key:value pair.

Attribute metadata for the enum type
An object returned with the following properties in addition to the base attribute metadata type properties:

  • OptionSet: Object. Options for the attribute where each option is a key:value pair.

Attribute metadata for the picklist type
An object returned with the following properties in addition to the base attribute metadata type properties:

  • DefaultFormValue: Number. Default form value for the attribute.
  • OptionSet: Object. Options for the attribute where each option is a key:value pair.

Attribute metadata for the state type
An object returned with the following properties in addition to the base attribute metadata type properties:

  • OptionSet: Object. Options for the attribute where each option is a key:value pair.

The object also contains the following methods:

  • getDefaultStatus(arg): Returns the default status (number) based on the passed in state value for an entity. For default state and status values for an entity, see entity metadata information of the entity in entity reference.
  • getStatusValuesForState(arg): Returns possible status values (array of numbers) for a specified state value. For state and status values for an entity, see entity metadata information of the entity in entity reference.

Attribute metadata for the status type
An object returned with the following properties in addition to the base attribute metadata type properties:

  • OptionSet: Object. Options for the attribute where each option is a key:value pair.

The object also contains the following method:

  • getState(arg): Returns the state value (number) for the specified status value (number). For default state and status values for an entity, see entity metadata information of the entity in entity reference.

Examples

// Get the metadata of "account" entity    
Microsoft.CIFramework.getEntityMetadata("account").then(
    function (result) {
        // result will have metadata of account, no attribute information will be fetched as the optional list is not passed.
        console.log(result)
    },
    function (error) {
        // code handling for promise failure
        console.log(error)
    });
// Get the metadata of "account" entity with empty attributes list.  
Microsoft.CIFramework.getEntityMetadata("account", []).then(
    function (result) {
        // result will have metadata of account, no attribute information will be fetched as the attributes list passed is empty.
        console.log(result)
    },
    function (error) {
        // code handling for promise failure
        console.log(error)
    });

// Get the metadata of "account" entity with specific attributes "createdon" and "name" info.  
Microsoft.CIFramework.getEntityMetadata("account", ['createdon', 'name']).then(
    function (result) {
        // result will have metadata of account, as well as attribute information for "createdon" and "name".
        console.log(result)
    },
    function (error) {
        // code handling for promise failure
        console.log(error)
    });