LoadFormData Class
Retrieve records related to the tokenized record id, and populate the values of a preference form.
Use methods in the LoadFormData class to set available and selected values in different form components:
The following are constructors for LoadFormData.
-
Creates an instance of the
LoadFormDataclass for running tests on any custom Apex classes you create for Preference Manager.
Creates an instance of the LoadFormData class for running tests on any custom Apex classes you create for Preference Manager.
public LoadFormData(Map<String,pref_center.FieldProperties> data)
- data: Type: Map<String,pref_center.FieldProperties>Map Maps preference form data from the field ID to the field properties.
This constructor is available in API version 56.0 and later.
The following are methods for LoadFormData.
-
addOption(fieldId, value, label)
Add an option for a checkbox, picklist, or radio button field in a preference form using the label and value.
-
Add a defined, selectable option for a checkbox, picklist, or radio button field in a preference form.
-
addSelectedOption(fieldId, option)
Add a selected option for a checkbox field in a preference form. This requires the field on the form to have a defined option with a set value.
-
setButtonLabel(fieldId, label)
Set the label of a button added to the preference form.
-
Add a list of selectable options for a field on a preference form.
-
setSelectedOption(fieldId, optionValue)
For a picklist or radio button field on a preference form that has defined values, set the value entered in the optionValue field as the selected option.
-
setSelectedOptions(fieldId, options)
For an existing checkbox field on a preference form that has defined values, set the values entered in the options field as the selected options. This requires the field on the form to have defined options with a set value.
-
setTextHint(fieldId, hintText)
Set the hint text inside a text input field. The hint text tells the user what type of information to enter, like an email address.
-
Set the value of a text field in a preference form.
Add an option for a checkbox, picklist, or radio button field in a preference form using the label and value.
public void addOption(String fieldId, String value, String label)
- fieldId: Type: String Identifies a field in the preference form.
- value: Type: String Represents the selection or text entered in a preference form field.
- label: Type: String The label for the value of a field in a preference form.
Type: void
Add a defined, selectable option for a checkbox, picklist, or radio button field in a preference form.
public void addOption(String fieldId, System.SelectOption option)
- fieldId: Type: String Identifies a field in the preference form.
- option: Type: System.SelectOption The option selected on a field in the preference form.
Type: void
Add a selected option for a checkbox field in a preference form. This requires the field on the form to have a defined option with a set value.
public void addSelectedOption(String fieldId, String option)
- fieldId: Type: String Identifies a field in the preference form.
- option: Type: String The selectable option being added.
Type: void
Set the label of a button added to the preference form.
public void setButtonLabel(String fieldId, String label)
- fieldId: Type: String Identifies a field in the preference form.
- label: Type: String The label for a button added to the preference form.
Type: void
Add a list of selectable options for a field on a preference form.
public void setOptions(String fieldId, List<System.SelectOption> options)
- fieldId: Type: String Identifies a field in the preference form.
- options: Type: List<System.SelectOption> The selectable options for a field in the preference form.
Type: void
For a picklist or radio button field on a preference form that has defined values, set the value entered in the optionValue field as the selected option.
public void setSelectedOption(String fieldId, String optionValue)
- fieldId: Type: String Identifies a field in the preference form.
- optionValue: Type: String The value for the selected option.
Type: void
For an existing checkbox field on a preference form that has defined values, set the values entered in the options field as the selected options. This requires the field on the form to have defined options with a set value.
public void setSelectedOptions(String fieldId, List<String> options)
- fieldId: Type: String Identifies the checkbox field in the preference form.
- options: Type: List<String> The selected options for a field in the preference form.
Type: void
Set the hint text inside a text input field. The hint text tells the user what type of information to enter, like an email address.
public void setTextHint(String fieldId, String hintText)
- fieldId: Type: String The ID of the text input field in the preference form.
- hintText: Type: String The hint text in the text input field.
Type: void
Set the value of a text field in a preference form.
public void setTextValue(String fieldId, String value)
- fieldId: Type: String Identifies a field in the preference form.
- value: Type: String Represents the value entered for the text field in a preference form.
Type: void