Basic DataSource: Retrieve Related Object Data
Last updated
Last updated
If you want to simply fetch related object data, consider using Basic DataSource settings. You can select an object related to Lookup or Line Item and map the fields of the retrieved object to the Lookup or Line Item fields via DataSource.
1
Source Object
Specify the Salesforce objects that you want to source data from.
β
2
Query
Click the Wizard button to open the Build Query layout. You can use the Query Wizard to easily build queries by searching for the correct fields to use.
Filters are entered in the format of a SOQL WHERE
clause.
3
Evaluation Event
Set the execution timing for the DataSource.
On Initialization: Executes when a new Line Item is added.
On Loading: Executes when the Line Item screen is loaded.
Before Save: Executes before a Line Item is saved.
4
Active
Turns the DataSource on or off. It must be active to be used.
β
5
Map the fields from the DataSource object to the Lookup or Line Item fields.
β
Actions involve mapping the data fetched from the DataSource to the fields in Lookup or Line Items. Through these actions, the DataSource values are applied to the designated fields.
1
Order
Specify the order that mappings are carried out.
β
2
Source Field
Select the field from the DataSource object.
β
3
Target Field
Select the target field in Lookup or Line Item where the data will be mapped.
β
4
Key
The unique identifier used for mapping data between the DataSource and Lookup or Line Item. The Key determines the target for the mapped DataSource values.
β
This example demonstrates the configuration of a Line Item Editor for Opportunity Products:
Parent: Opportunity
Line Item: OpportunityLineItem
Lookup: Product2
When the Lookup Object is set to Product2, users often want to display UnitPrice information. However, in Salesforce, the UnitPrice is stored in the PricebookEntry object, which is a child object of Product. Since UnitPrice cannot be fetched via a formula field, we use a DataSource to query the related PricebookEntry data.
In the DataSource settings, specify the Source Object as PricebookEntry.
(optional) Click Query Wizard to set up the query conditions:
IsActive = true AND Pricebook2Id = {$Parent.Pricebook2Id}
To match the PricebookEntry data to the Products, use the following settings:
Source Field: Product2Id
Target Field: Id
Key: true
To display the Unit Price alongside the product data, add an Action and map the fields to a virtual column in Lookup:
Source Field: UnitPrice
Target Field: SBLI_Virtual1
Available only for Line Items.