Lookup Field
Virtual input lookup field: Adding virtual fields to the form
Source object input lookup field: Adding data source fields
Ignore Permissions - loads all available records to the lookup search including those that are not available due to user permissions.
Object Lookup Properties:
- Source Type - choose source type for the lookup. Can be sObject or Apex. Select "Apex" to use DataProvider.
Available starting from version 5.0
- Field - (available for sObject Source Type) - choose field of Data Source object that will be used to display lookup option items
- Size - (available for sObject Source Type) - limits lookup options list to the specified number of records
Available starting from version 6.0
- Source Object - (available for sObject Source Type) - available for multi-reference lookups only (e.g. Task -> WhatId (Related To ID)).
- This lookup will allow to select objects that are met all the following conditions:
- Objects are listed in multi-reference lookup field Data Type property (Setup -> Object Manager -> %Object% -> %Lookup Field%)
- Objects are selected as allowed in Settings (Settings -> Objects Settings -> Allowed Objects)
Object Lookup Pre-populate:
Pre-population can be done like for any other Object field. Pass the Id of the record of Lookup Data Source object as a parameter to the form.
- Parameter name should be equal to API Name of the lookup field (1).
- Parameter value should be an ID or, if lookup is based on another field, use value of this field (2).
Virtual Lookup Properties:
- Source Type - choose source type for the lookup. Can be sObject, Apex or JSON.
- Use sObject Source Type to search for records in Sales Force.
- Source Object - choose source object for the lookup
- Field - choose field that will be used to display lookup option items
- Size - limits lookup options list to the specified number of records
- Default Value - provide default value if needed
- Use Apex Source Type to get lookup using DataProvider.
- Choose JSON Source Type to build lookup options using JSON array.
- Pass array of JSON objects of a following format:
[
{"id":"lookupOptionValue", "name":"lookupOptionLabel"},
{"id":"lookupOptionValue2","name":"lookupOptionLabel2"},
{"id":"lookupOptionValue3", "name":"lookupOptionLabel3"}
]
where "lookupOptionValueX" is option value and "lookupOptionLabelX" is label of the lookup option.
To provide Default Value use lookup Option Id (e.g., "lookupOptionValue2", so in example above it will be passed as Default Value). This will result in following:
User can define lookup filters using Conditions feature.
Adding filters for lookup field
1. Click Lookup component (1) on a canvas.
2. Click Conditions (2).
3. Provide parameters for filtering
Values should be passed in the format of where clause of SOQL query e.g. using fields API names and SOQL operators.
5. Save your changes.
6. Run the form preview.
Only active accounts with the phone not blank are displayed in picklist (3):
Apex Class
Data Provider allows to populate lookups/lists with custom data collected in Apex class.
Create an Apex class which implements WR_BPM.FormBuilderService.FormBuilderApiInterface Interface.
Class should have 2 public methods: loadListData, loadLookupData.
See example attached:
Click lookup "Campaign" (4). Select "Apex" Source Type (5) to see "Data Provider" input. Click icon (6) to select the class. Apply it.
Parameters (7) should be passed as a JSON object:
Attached is a form which can be imported to your organization along with the class attached above to see examples of using Data Provider.
FormService
Built-in FormService Data Provider allows to feed JSON data to lookup. Using FormService Data Provider user can build lookup without interaction with database or using Apex code.
Click lookup (8), select "FormService" in "Data Provider" input (9). Fill in "Parameters" input (10). Pass JSON array of lookup options via Parameters (11):
Here's how lookup looks like in form preview:
Below is example form that can be uploaded to your organization:
Choose input lookup Source Object and fill in default value with source object id. It can be both string or merged field.
NOTE: Source object of test form is Account.
For lookups with FormService DataProvider and with JSON Source Type default value should be one of ID values - lookup will show the "Name" property value corresponding to default ID.
For lookups with other DataProviders user is to use Update Value form action to be triggered by form onLoad event. Update Value action will update picklist to default value, default value should be required option value.
For more information regarding Update Value form action please refer following article: Update Value action type
Input Lookup component has following conditional style options:
- hide
- show
- required
- disable
- clear
Note: some system fields of this type (e.g., Created By ID) can't be modified directly and have only "Show" and "Hide" conditional styles
0 Comments
Add your comment