-
Notifications
You must be signed in to change notification settings - Fork 97
soqlDatatable: Configurable Flow and LWC actions
Important Note: There is additional config needed to make Configurable actions work. Please see the configuration section for this LWC.
Each soqlDatatable can be have one defined Action Configuration (Datatable_Config__mdt) to define both Table level (supporting multi / single select) and Row Level actions. This can be the same Datatable_Config__mdt as used in the Lookup Configuration section.
Because of a limitation with cmdt, the Type__c on the parent Datatable_Config__mdt must be text of Actions. For combined configs, use Actions; Lookups.
Both LWCs (inside a dialog) and Screen Flows can be launched from either action type. The configuration is easier to explain in picture format:

Assign New Account - Flow Table Action
The button is configured to the SOQL_Datatable_Flow_Action_Update_Contacts_with_New_Account Screen Flow.
soqlDatatable sends the following inputVariables to Flows.
All of the following must be implemented as variables if the Screen Flow backs an action, otherwise you will get an error.
| Name | Type | Value |
|---|---|---|
| SelectedRows | SObject[] | Choose the correct Object type in a Record Collection. |
| FirstSelectedRow | SObject | First Selected Row, choose the correct Object in a Record variable. |
| UniqueBoundary | String | For dialogAutoCloser to refresh the table that opened the Screen Flow. |
| SourceRecordId | String | The recordId of the page that the soqlDatatable is placed on. |
When the flow is done, it auto-closes using dialogAutoCloser.

Note: Due to how data is constructed in
soqlDatatable, you cannot use theSelectedRowsdirectly in aUpdate Records. Always assign values you specifically want to update to a new Record Variable that is not an output ofsoqlDatatable, which in this example isContactShell/ContactToUpdate.
Check Opportunities - LWC Table Action
This button configured to open the checkOpportunitiesExample LWC.
Notice the public attributes, these are always supplied by soqlDatatable when invoking an LWC.
<template>
<c-message-service boundary={uniqueBoundary}></c-message-service>
<template if:true={queryString}>
<c-soql-datatable query-string={queryString}></c-soql-datatable>
</template>
<template if:false={queryString}>
<div class="slds-align_absolute-center">
No Contacts Selected. Please choose contacts to view opportunities for.
</div>
</template>
</template>...
@api uniqueBoundary;
@api selectedRows;
@api sourceRecordId;
queryString;
// private
_isRendered;
_messageService;
_accountIdSet = new Set();
connectedCallback() {
if (this.selectedRows && this.selectedRows.length) {
this.selectedRows.forEach(row => {
this._accountIdSet.add(`'${row.AccountId}'`);
});
}
if (this._accountIdSet.size > 0) {
let accountIds = Array.from(this._accountIdSet.keys());
this.queryString = convertToSingleLineString`
SELECT Account.Name, Name, Amount, CloseDate, StageName
FROM Opportunity
WHERE AccountId IN (${accountIds.join(',')})
ORDER BY Account.Name ASC
`;
}
}
...Remove Phone - Flow Row Action
The button is configured to the SOQL_Datatable_Flow_Row_Action_Remove_Contact_Phone Screen Flow.
This Screen Flow also auto-closes with dialogAutoCloser.

Note: Due to how data is constructed in
soqlDatatable, you cannot use theFirstSelectedRecorddirectly in anUpdate Records. Always assign values you specifically want to update to a new Record Variable that is not an output ofsoqlDatatable, which in this example isContactToUpdate.