Dynamic Actions
In the data aggregation component, records are from multiple data tables. The behavior on each record can be different.
- For example, a list view with accounts from
loan__Loan_Account__c
,cllease__Lease_Account__c
, andcollect__Loan_Account__c
- When clicking a record, the corresponding detail view should be open based on the record’s source.
Status
Release Available | Status | Framework Name |
---|---|---|
Initial | Current | MUI and Mint |
Implementation Example
- Let’s form three component JSONs for three detail views:
basic_contracts_v2.json
loan_basic_contracts_v2.json
lease_basic_contracts_v2.json
{ "structureName": "basic_contracts_v2", "tableName": "collect__Loan_Account__c", "whereClause": { "freeForm": " id = ':id'" }, } { "structureName": "loan_basic_contracts_v2", "tableName": "loan__Loan_Account__c", "whereClause": { "freeForm": " id = ':id'" }, } { "structureName": "lease_basic_contracts_v2", "tableName": "cllease__Lease_Account__c", "whereClause": { "freeForm": " id = ':id'" }, }
Then, use
addOnFields
key to add action-specific data to each data model."loanAccountDataModel": { "category": "component", "type": "data-model", "property": {"structureName": "loan_account_data_model_v2", "addOnFields": {"detail_view_structure_name": "loan_basic_contracts_v2"}} }, "leaseAccountDataModel": { "category": "component", "type": "data-model", "property": {"structureName": "lease_account_data_model_v2", "addOnFields": {"detail_view_structure_name": "lease_basic_contracts_v2"}} }, "collectAccountDataModel": { "category": "component", "type": "data-model", "property": {"structureName": "collect_account_data_model_v2", "addOnFields": {"detail_view_structure_name": "basic_contracts_v2"}} },
clickRecord
handler can use theaddOnFields
value to dynamically set thestructureName
of the detail view."generalHandlers": { "clickRecord": { "assignments": [ { "field": "$nav(accountDetailView).property(structureName);", "value": "$args[0].attr(DetailViewStructure);" }, { "field": "$nav(accountDetailView).property(whereClause.id);", "value": "$args[0].attr(id);" } ], "next": "DetailPage" } }