편집

다음을 통해 공유


MetadataService type

Important

The finance and operations (Dynamics 365) mobile app and platform are no longer supported. The platform components supporting the mobile app will be removed in a future update. The mobile app has also been removed from app stores. Previously installed instances of the app will continue to work. For more information, see Removed or deprecated platform features.

Provides ability to access and configure various metadata elements under the application workspace.

Hierarchy

MetadataService

Index

Properties

Methods

Properties

version

version: string

(Read-only) Gets the version of the platform currently running.

Methods

addControl

addControl(componentName: string, controlName: string, controlType: ControlType, parentContainerName?: string, options?: ControlMetadata): any

Parameters

Name Type Description
componentName string
controlName string
controlType ControlType
parentContainerName? string
options? ControlMetadata

Returns any

compareVersion

compareVersion(versionToCompare: string): 1 | -1

Compares the current platform version with a reference version.

Parameters

Name Type Description
versionToCompare string The reference version to compare with

Returns 1 | -1

1 to indicate the platform version is older than the reference version, -1 to indicate that the platform version is newer or same as the reference version

configureAction

configureAction(actionName: string, options: PageMetadata): any

Configuring an action allows specifying or overriding certain behaviors specific to actions. Example:

metadataService.configureAction('Edit-Reservation', { properties-to-set });

Parameters

Name Type Description
actionName string The action whose behavior is to be changed
options PageMetadata The property bag containing the properties to set on the action

Returns any

configureControl

configureControl(componentName: string, controlName: string, options: ControlMetadata): any

Configuring a control allows specifying or overriding certain behaviors specific to the control. Note that the available behaviors vary by control type. Example:

metadataService.configureControl('All-Customers', 'FMCustomer_RecId', { properties-to-set });

Parameters

Name Type Description
componentName string A page or action that contains the control
controlName string The control whose behavior is to be changed
options ControlMetadata The property bag containing the properties to set on the control

Returns any

configureEntity

configureEntity(entityName: string, options: any): any

Configuring an entity allows specifying or overriding certain behaviors specific to the entity. Example:

metadataService.configureEntity("FMCustomer", { properties-to-set });

Parameters

Name Type Description
entityName string An entity name
options any The property bag containing the properties to set on the entity

Returns any

configureLookup

configureLookup(taskName: string, lookupControlName: string, options: LookupMetadata): any

Configures a field on an action to behave as a lookup. Requires using an existing page which contains a list control. Example:

metadataService.configureLookup('Add-Reservation', 'FMRental_Customer', { lookupPage: 'All-Customers', valueField: 'FMCustomer_RecId', displayField: 'FMCustomer_FullName'});

Parameters

Name Type Description
taskName string Action name
lookupControlName string The control name of the field to be given lookup behavior
options LookupMetadata Lookup configuration object

Returns any

configurePage

configurePage(pageName: string, options: PageMetadata): any

Configuring a Page allows specifying or overriding certain behaviors specific to the Page. Example:

metadataService.configurePage('Reservation-details', { properties-to-set });

Parameters

Name Type Description
pageName string The page that contains the control
options PageMetadata The property bag containing the properties to set on the page

Returns any

configureWorkspace

configureWorkspace(options: PageMetadata): any

Configuring a workspace allows specifying or overriding certain behaviors specific to the workspace. Example:

metadataService.configureWorkspace({ properties-to-set });

Parameters

Name Type Description
options PageMetadata The property bag containing the properties to set on the workspace

Returns any

findAction

findAction(actionName: string): PageMetadata

Gets a copy of the current metadata instance of a specified Action, for the purpose of inspecting the metadata (not to be used for changing the metadata). Note: Since metadata can be changed at any time by business logic, you must be mindful of when you use this API to get a copy as it will reflect the state of the metadata at the time the call is made.

Example:

var newCustomerTaskMetadata = metadataService.findTask("New-customer");

Parameters

Name Type Description
actionName string An action name

Returns PageMetadata

findControl

findControl(componentMetadata: any, controlName: string): ControlMetadata

Gets a copy of the current metadata instance of a specified control, for the purpose of inspecting the metadata (not to be used for changing the metadata). Note: Since metadata can be changed at any time by business logic, you must be mindful of when you use this API to get a copy as it will reflect the state of the metadata at the time the call is made.

Example:

var firstNameControl = metadataService.findControl(newCustomerTaskMetadata, 'FMCustomer_FirstName');

Parameters

Name Type Description
componentMetadata any A metadata instance of the page or action
controlName string A control name

Returns ControlMetadata

findPage

findPage(pageName: string): PageMetadata

Gets a copy of the current metadata instance of a specified page, for the purpose of inspecting the metadata (not to be used for changing the metadata). Note: Since metadata can be changed at any time by business logic, you must be mindful of when you use this API to get a copy as it will reflect the state of the metadata at the time the call is made.

Example:

var reservationDetailsMetadata = metadataService.findPage("Reservation-details");

Parameters

Name Type Description
pageName string A page name

Returns PageMetadata

getFilterExpression

getFilterExpression(pageName: string, listControlName: string, controlName: string, operator: ExpressionOperator, value: string): DataFilter

Create a DataFilter object for a list control based on the provided options. Example:

var filter = metadataService.getFilterExpression(
 pageNames.AllCustomers, controlNames.CustomerList, controlNames.CustomerFullName, "Is", firstCustomerName),

Parameters

Name Type Description
pageName string
listControlName string
controlName string
operator ExpressionOperator
value string

Returns DataFilter

getFormReference

getFormReference(componentName: string, filterContext: DataFilter, excludeContext: boolean, filterLocalOnly?: boolean): NavigationArgs

Create an INavigationArgs object for a specific page/action to be used with a navigation control.

Parameters

Name Type Description
componentName string Name of the action/page
filterContext DataFilter
excludeContext boolean
filterLocalOnly? boolean

Returns NavigationArgs

hideNavigation

hideNavigation(pageNamesToHide: string [ ]): any

Hides the specified page(s) from the default landing page. Example:

metadataService.hideNavigation('Select-a-customer', 'Select-a-vehicle');

Parameters

Name Type Description
pageNamesToHide string [ ] Page name(s)

Returns any