Class DialogCustomScripting

This class supports the functionality for custom scripting on a dialog. You can access all the methods by using the namespace CSL.dialog.

Hierarchy

  • CslBase
    • DialogCustomScripting

Properties

componentId: string = ''

The component id of the current view instance.

Accessors

  • get componentConfig(): Component
  • The configuration of the component to render.

    Returns Component

  • get htmlElement(): any
  • The rendered HTML of the view.

    Returns any

  • get viewConfig(): UpdateView | MultiRecordView | SingleRecordView | CreateView
  • The configuration of the view to render.

    Returns UpdateView | MultiRecordView | SingleRecordView | CreateView

  • get viewFields(): ViewField[]
  • The viewFields of the view.

    Returns ViewField[]

Methods

  • Closes the current dialog or the one with the specified id.

    // Close the current dialog.
    CSL.dialog.close();

    // Get dialogs by view options.
    const dialogs = CSL.dialog.getDialogsByViewOptions('Product', 'Get All Products');
    // Close all found dialogs.
    dialog.forEach((dialog) => {
    const dialogId = CSL.dialog.getComponentIdOfDialog(dialog);
    CSL.dialog.close(dialogId);
    });

    Parameters

    • Optional componentId: string

    Returns string

  • Get all the registered dialog instances on the page.

    let openDialogs = CSL.dialog.getAll();
    

    Returns AdmDialogRef<IDialogInstance>[]

  • Get the child dialogs of the component. A child dialog is a dialog that is opened from another component.

    // Get the child dialogs of current dialog.
    let childDialogs1 = CSL.dialog.getChildDialogsByComponentId();

    // Get the child dialogs of component with id 'abj36'.
    let childDialogs2 = CSL.dialog.getChildDialogsByComponentId('abj36');

    Parameters

    • Optional componentId: string

      The id of the component.

    Returns AdmDialogRef<IDialogInstance>[]

  • Gets the component id of a dialog.

    // Get dialogs based on view options.
    const dialogs = CSL.dialog.getDialogsByViewOptions('Product', 'Get All Products');

    // Get the id of the first dialog.
    const dialogComponentId = CSL.dialog.getComponentIdOfDialog(dialogs[0]);

    Parameters

    • dialogInstance: AdmDialogRef<IDialogInstance>

      The dialog instance on which the component id will be fetched.

    Returns string

  • Get the dialogs that have specified view options.

    // Get dialogs that have specified view and object names.
    let dialogs1 = CSL.dialog.getDialogsByViewOptions('Product', 'Get All Products');

    // Get dialogs from specific component.
    let dialogInstances = CSL.dialog.getChildDialogsByComponentId();
    let dialogs2 = CSL.dialog.getDialogsByViewOptions('Product', 'Get All Products', dialogInstances);

    Parameters

    • object: string

      The object name of the component.

    • viewName: string

      The view name of the component.

    • Optional dialogInstances: AdmDialogRef<IDialogInstance>[]

      The dialogs to search through. If not specified, all dialogs on the page will be used.

    Returns AdmDialogRef<IDialogInstance>[]

  • Get a dialog by its component id.

    // This view is in a dialog and you want the dialog instance of this view.
    let currentDialog = CSL.dialog.getInstance();

    // The parent of this dialog is also in a dialog and you want to get the parent dialog instance.
    let parentDialog = CSL.dialog.getInstance(currentDialog.parentId);

    Parameters

    • Optional componentId: string

      The unique identifier of the component.

    Returns AdmDialogRef<ViewDialogComponent>

  • Opens a new dialog with the provided view.

    CSL.dialog.open('Product', 'Get Product', [{'name': 'John', 'age': 35}], undefined, componentId);

    // When no componentId is defined, the id of the current component will be used.
    CSL.dialog.open('Product', 'Get Product', [{'name': 'John', 'age': 35}]);

    // When the dialog should act like a modal dialog with a gray overlay.
    CSL.dialog.open('Product', 'Get Product', [{'name': 'John', 'age': 35}], { isModal: true });

    // When the state of the dialog needs to be tracked, a promise is returned.
    let dialogState = CSL.dialog.open('Product', 'Get Product', [{'name': 'John', 'age': 35}], { trackState: true });
    dialogState.then((closedAfterSuccessfulSave) => {
    if (closedAfterSuccessfulSave) {
    // Something to do when the dialog has been saved successfully.
    } else {
    // Something to do when the dialog has been closed without saving the data.
    }
    })

    Parameters

    • objectName: string

      The name of the object which contains the field

    • viewName: string

      The name of the view to present.

    • Optional contextRecords: ValueObject<any>[]

      The context records to pass with the prepare call.

    • Optional cslDialogOptions: CslDialogOpenOptions

      Any options to use for opening the dialog.

    • Optional componentId: string

      The id of the component.

    Returns string | Promise<boolean>

Generated using TypeDoc