TreeINFO-For-M365 documentation
    Preparing search index...

    Interface TypeDocHidden_IFormService

    Provides the interface for form management. It allows to manage fields, groups, and other properties. For detailed information on managing specific elements, refer to the Field and Group classes.

    const { form } = tisa;

    // Check if the form is in edit mode
    if (form.isEditForm) {
    // your code...
    }

    // Check if the form is new
    if (form.isNewForm) {
    // your code...
    }

    // Check if the form is in display mode
    if (form.isDisplayForm) {
    // your code...
    }

    // Get a field value
    const { myField1 } = form.field;
    console.log(myField1.value);

    // Set a field value
    myField1.value = 'any value';
    console.log(myField1.value);

    // Set the read-only property
    myField1.readOnly = true;
    console.log(myField1.readOnly);

    // Set the hidden property
    myField1.hidden = true;
    console.log(myField1.hidden);
    interface TypeDocHidden_IFormService {
        field: Dictionary<TypeDocHidden_IFieldService>;
        fieldValues: Dictionary<any>;
        group: Dictionary<IGroupService>;
        isDisplayForm: boolean;
        isEditableForm: boolean;
        isEditForm: boolean;
        isNewForm: boolean;
        isTaskForm: boolean;
        print: Print;
        readOnly: boolean;
        setFormDefinition(name: string): void;
    }

    Implemented by

    Index

    Properties

    field: Dictionary<TypeDocHidden_IFieldService>

    Provides access to form fields.

    const value = tisa.form.field.myField1.value;
    console.log(value);

    const { myField1 } = tisa.form.field;
    myField1.readOnly = true;
    fieldValues: Dictionary<any>

    Gets the values of all fields in the form. The values are stored in a dictionary with the field internal name as the key and the field value as the value.

    const { form } = tisa;
    const fieldValues = form.fieldValues;
    console.log(fieldValues);
    group: Dictionary<IGroupService>

    Provides access to form groups.

    const { G_Supplier } = tisa.form.group;
    G_Supplier.hidden = true;
    isDisplayForm: boolean

    Gets a value indicating whether the form does not allow to edit the item.

    const { form } = tisa;
    if (form.isDisplayForm) {
    // your code...
    }
    isEditableForm: boolean

    Gets a value indicating whether the form is currently editable. The isEditableForm property is true when either isNewForm or isEditForm is true.

    const { form } = tisa;
    const { myField1, myField2, myField3 } = tisa.form.field;
    if (form.isEditableForm) {
    // set read-only property for some fields
    myField1.readOnly = true;
    myField2.readOnly = false;

    // set required property for some fields
    myField2.required = true;

    // set value for some fields
    myField3.value = "test";
    }
    isEditForm: boolean

    Gets a value indicating whether the form allows to edit the item.

    const { form } = tisa;
    if (form.isEditForm) {
    // your code...
    }
    isNewForm: boolean

    Gets a value indicating whether the item does not yet exist and the form allows to fill in its metadata.

    const { form } = tisa;
    const { myField1, myField2 } = tisa.form.field;
    if (form.isNewForm) {
    // copy value of field1 to field2 when it changes
    myField1.onChange((value) => {
    myField2.value = value;
    });
    }
    isTaskForm: boolean

    True if the form displays a task to complete.

    const { form } = tisa;
    if (form.isTaskForm) {
    // your code...
    }
    print: Print

    Provides print template functionality for the current form.

    const { form } = tisa;

    // Open a print template in a new window
    await form.print.show("ContractCoverSheet");

    // Open with debug box showing all form data
    await form.print.show("TestTemplate", true);
    readOnly: boolean

    Gets or sets the editability of the form. Locks all editable fields when set to true.

    const { form } = tisa;
    form.readOnly = true;

    Methods

    • Sets the active form definition by name. The name must match one of the Form.CustomFormDefinitions | CustomFormDefinitions defined in the form JSON config.

      Can only be called during onFormInit. Throws if called after init or if the name is not found.

      Parameters

      • name: string

        Name of the custom form definition to activate.

      Returns void

      async function onFormInit() {
      const { form } = tisa;

      if (form.isDisplayForm) {
      form.setFormDefinition("DisplayForm");
      } else if (form.isNewForm) {
      form.setFormDefinition("ReceivedMessage");
      }
      }