-
Notifications
You must be signed in to change notification settings - Fork 93
soqlDatatable: Record Context with $CurrentRecord API
James Hou edited this page Jan 31, 2021
·
3 revisions
Note: This feature is only available on Record Page / Flexipage.
$CurrentRecord
and $recordId
are special syntax that allows for merge-fields of current record data into the SOQL string. By using them, you can merge current record context as values in the WHERE
clause as follows:
// Find other Accounts similar to this Account's Industry
SELECT Name, Type, Website, Industry
FROM Account
WHERE Industry = $CurrentRecord.Industry
AND Id != $recordId
// Find related contacts with same MailingState as this Account's BillingState
SELECT Name, Email, MailingState, Account.BillingState
FROM Contact
WHERE AccountId = $recordId
AND MailingState = $CurrentRecord.BillingState
This uses Lightning Data Service (getRecord
) to retrieve and resolve the record values, so make sure your user(s) have FLS enabled for any fields you plan on using the $CurrentRecord
feature with.
All data types that can be SOQL-ed are supported for $CurrentRecord
.
Please submit issues to this repo if you find one that cannot be merged correctly.