ftos.metadata.getForm
Retrieves the metadata definition of an entity form.
Syntax
Copy
ftos.metadata.getForm(entityName: string, formName: string): WorkflowUserJourneyMetadata
| Parameter | Type | Description |
|---|---|---|
entityName
|
string | Name of the form's parent entity. |
formName
|
string | Name of the entity's form whose form metadata is to be retrieved. |
Return Value
Returns an WorkflowUserJourneyMetadata object.
Interfaces
WorkflowUserJourneyMetadata
Metadata definition of a workflow form, including the form structure and section details.
Copy
interface WorkflowUserJourneyMetadata {
form: WorkflowUserJourneyMetadataForm;
sections: any[];
}
| Property | Type | Description |
|---|---|---|
form
|
WorkflowUserJourneyMetadataForm | Metadata describing the form and its fields. |
sections
|
any[] | An array representing the form's sections. |
WorkflowUserJourneyMetadataForm
Describes the structure and field composition of a form.
Copy
interface WorkflowUserJourneyMetadataForm {
fields: WorkflowUserJourneyMetadataField[];
name: string;
}
| Property | Type | Description |
|---|---|---|
fields
|
WorkflowUserJourneyMetadataField[] | An array of metadata objects, each describing an individual field of the form. |
name
|
string | The name of the form. |
WorkflowUserJourneyMetadataField
Metadata for a single form field.
Copy
interface WorkflowUserJourneyMetadataField {
name: string;
displayName: string;
type:'Bool' | 'Color' | 'Date' | 'Date Time' | 'File' |
'Html' | 'Icon Picker' | 'Js' | 'json' | 'Lookup' | 'Map' |
'Money' | 'Numeric' | 'Option Set' | 'Order Index' | 'Pk' |
'Regarding Lookup' | 'Text' | 'Text Area' | 'Whole Number';
defaultValue: string | WorkflowUserJourneyMetadataLookupValue;
requiredLevel: "None" | "Recommended" | "Required";
lookupValues: WorkflowUserJourneyMetadataLookupValue[];
isReadOnly?: boolean;
}
| Property | Type | Description |
|---|---|---|
name
|
string | The system name of the field. |
displayName
|
string | The user-friendly display name of the field as shown on screen. |
type
|
string | The data type of the field. |
defaultValue
|
string | WorkflowUserJourneyMetadataLookupValue | Default value assigned to the field (a primitive value or a lookup reference). |
requiredLevel
|
"None" | "Recommended" | "Required" | Whether the field is optional, suggested, or mandatory. |
lookupValues
|
WorkflowUserJourneyMetadataLookupValue[] | A list of available lookup values (e.g., for lookup or option set fields). |
isReadOnly (optional) |
boolean | Indicates whether the field is read-only. |
WorkflowUserJourneyMetadataLookupValue
Metadata for a selectable value in a lookup or option set field.
Copy
interface WorkflowUserJourneyMetadataLookupValue {
id: string;
displayName: string;
}
| Property | Type | Description |
|---|---|---|
id
|
string | The unique identifier of the lookup item. |
displayName
|
string | The display name associated with the lookup item. |
Examples
This example:
- Retrieves the metadata of the default single-page form associated to the currently displayed entity.
- The metadata is then stored in the output variable and converted to a JSON string.
Copy
var output = ftos.metadata.getForm(ftos.context.entityName, 'default');
output = JSON.stringify(output);
The resulting value saved in the output variable is:
Copy
{
"Form": {
"Name": "default",
"EntityName": "doc001",
"PrimaryKeyName": "doc001id",
"Fields": [
{
"Name": "authorizedCurrencies",
"DisplayName": "{ authorizedCurrencies | attribute}",
"Type": "text",
"RequiredLevel": "None"
},
{
"Name": "citizenship",
"DisplayName": "{ citizenship | attribute}",
"Type": "optionset",
"RequiredLevel": "None",
"LookupValues": [
{
"Id": "b8588b46-d5fc-46c0-9ac8-05aadd1fd038",
"DisplayName": "Romana"
},
{
"Id": "c62e6a8f-447b-47c3-b504-67012116c90f",
"DisplayName": "American"
},
{
"Id": "be416524-da4d-4bcb-a904-1b7f1230ae06",
"DisplayName": "UK"
}
]
},
{
"Name": "name",
"DisplayName": "{ name | attribute}",
"Type": "text",
"RequiredLevel": "None"
}
]
},
"Sections": []
}
This example
- Retrieves the metadata of the doc001 multi-step form associated with the currently displayed entity.
- The metadata is stored in the output variable and then converted into a JSON-formatted string.
Copy
var output = ftos.metadata.getForm(ftos.context.entityName, 'doc001');
output = JSON.stringify(output);
The resulting value saved in the output variable is:
Copy
{
"Form": {
"Name": "doc001",
"EntityName": "doc001",
"PrimaryKeyName": "doc001id",
"Fields": []
},
"Sections": [
{
"Name": "Step1",
"DisplayName": "Hello",
"Fields": []
},
{
"Name": "Step2",
"DisplayName": "Inputs",
"Fields": [
{
"Name": "name",
"DisplayName": "{name | attribute}",
"Type": "text",
"RequiredLevel": "None"
},
{
"Name": "citizenship",
"DisplayName": "{citizenship | attribute}",
"Type": "optionset",
"RequiredLevel": "None",
"LookupValues": [
{
"Id": "b8588b46-d5fc-46c0-9ac8-05aadd1fd038",
"DisplayName": "Romana"
},
{
"Id": "c62e6a8f-447b-47c3-b504-67012116c90f",
"DisplayName": "American"
},
{
"Id": "be416524-da4d-4bcb-a904-1b7f1230ae06",
"DisplayName": "UK"
}
]
}
]
},
{
"Name": "Step3",
"DisplayName": "Tests",
"Fields": [
{
"Name": "authorizedCurrencies",
"DisplayName": "{authorizedCurrencies | attribute}",
"Type": "text",
"RequiredLevel": "None"
}
]
},
{
"Name": "Step4",
"DisplayName": "Good Bye",
"Fields": []
}
]
}