編輯

共用方式為


formContext.ui.formSelector (Client API reference)

The formContext.ui.formSelector property lets you work with form items where a form item represents a form that is available to a user because it is associated with a security role that the user is also associated to. Often there will be only one form. When more than one form is available, methods for a form item can be used to change the form the user is viewing.

Note

The formContext.ui.formSelectoris not supported for quick create forms.

Note

The form selector is not visible if the user only has access to one main form

Form Items are available through any of the following:

  • formselector.items collection: A collection of all the form items accessible to the current user. Only those forms that share an association with one of the user's security roles are available in this collection. Example:

    formItem = formContext.ui.formSelector.items.get(arg);

    See Collections for information about the collection methods.

    Note

    This collection isn't available for Dynamics 365 mobile clients (phones and tablets).

  • formselector.getCurrentItem method: Returns a reference to the form currently being shown. When only one form is available this method will return null. Example:

    formItem = formContext.ui.formSelector.getCurrentItem();

Form Item methods

After retrieving a form item using one of the above ways, use the following methods to work with the form item.

Name Decription
getId Returns the ID of the form.
getLabel Returns the label of the form.
getVisible Returns a value that indicates whether the form is currently visible.
navigate Opens the specified form.
setVisible Sets a value that indicates whether the form is visible.