ebs.renderWithMultiSelectControl
Renders a multi-select control that allows users to populate a text attribute with a set of predefined values. The available values can be sourced from:
- An option set
- An entity's attribute values
- A custom list
This function must be invoked from the form's Before Generate event handler. For details about the default client-side app logic events, see the code execution sequence documentation.
When applied, the attribute's original text field is replaced with the multi-select control. The attribute’s value is saved as an array-formatted string, for example:
['first choice', 'second choice', 'third choice']
Syntax
function renderWithMultiSelectControl(
attrName: string,
options: IMultiSelectControlOptions,
)
| Parameter | Type | Description |
|---|---|---|
attrName
|
string | Name of the text attribute to populate with the multi-select control. |
options
|
IMultiSelectControlOptions | Data source for the selection options. Can be an option set, entity, or custom list. |
Interfaces
IMultiSelectControlOptions
Data source for the values available in a multi-select control.
interface IMultiSelectControlOptions {
availableItems?: { key: string; value: any }[];
availableItemsSource?: {
type: "optionSet" | "entity";
referenceName: string;
keyProperty?: string;
displayProperty?: string;
};
}
| Property | Type | Description |
|---|---|---|
| availableItems (optional) | { key: string; value: any }[] | Key-value pairs for a custom list. The key is displayed in the selector, while the value is stored in the underlying text attribute. |
| availableItemsSource (optional) | JSON | Data source when the values are pulled from an option set or entity. |
| type | string | Source type:
|
| referenceName | string | Name of the option set or entity used as the selection source. |
| keyProperty (optional) | string | For entity-based sources, the name of the attribute providing the stored values. |
| displayProperty (optional) | string | For entity-based sources, the name of the attribute providing the values displayed in the selector. |
Examples
In this example, the FTOS_CB_ContractRole option set is used to populate the accountId_role attribute with predefined roles that a contract party may hold:
var roles = {
availableItemsSource:{
type: "optionSet",
referenceName: "FTOS_CB_ContractRole"
}
};
ebs.renderWithMultiSelectControl("accountId_role", roles);
Result:
- User sees: the labels defined in the FTOS_CB_ContractRole option set (e.g.: Borrower, Co-borrower, Guarantor, Insured, Beneficiary, etc.).
- The stored attribute value could look like: ["coBorrower", "guarantor"].
This example defines a custom list of departments. The key values are displayed in the multi-select control, while the value entries are stored in the employee_departments attribute.
var departments = {
availableItems: [
{ key: "Finance", value: "FIN" },
{ key: "Human Resources", value: "HR" },
{ key: "IT", value: "IT" },
{ key: "Marketing", value: "MKT" }
]
};
ebs.renderWithMultiSelectControl("employee_departments", departments);
Result:
- The user sees: Finance, Human Resources, IT, Marketing
- The stored attribute value could look like: ["FIN", "HR"]
This example uses the Customer entity to populate the contract_customers attribute with existing customer records.
- The customerId is stored in the text attribute.
- The fullName is displayed in the multi-select control.
var customers = {
availableItemsSource: {
type: "entity",
referenceName: "Customer",
keyProperty: "customerId",
displayProperty: "fullName"
}
};
ebs.renderWithMultiSelectControl("contract_customers", customers);
Result:
- The user sees a list of customer full names.
- The stored attribute value could look like: ["CUST123", "CUST456"]