2

I am trying to display a simple data table with Opportunity fields as well as parent fields, however, it seems that there is no (intuitive) way for me to display the parent fields, such as Account.

My query:

select StageName, Account.FirstName from Opportunity limit 3

My datatable JSON:

[
{
    "fieldName": "StageName",
    "label": "StageName",
    "searchable": true,
    "sortable": true
},
{
    "fieldName": "AccountId",
    "label": "AccountId",
    "searchable": true,
    "sortable": true
},
{
    "fieldName": "Id",
    "label": "Id",
    "searchable": true,
    "sortable": true
}

]

So I don't know if it's possible to amend the JSON to display this, but in the declarative DataTable box I cannot see the parent field, i.e. FirstName (yep, person accounts are on) enter image description here

When I test the SOQL query I get [object Object] as a value in the column which would have to represent the Account FirstName.

enter image description here

Any help would be greatly appreciated!

Regards, Vio

1 Answer 1

2

The query you're using will return you an array of Opportunity objects, and each Opportunity object will contain a nested Account object. This is why the output shows [object Object]. Example of the JSON returned using the query:

[
    {
        "attributes": {
            "type": "Opportunity",
            "url": "/services/data/v60.0/sobjects/Opportunity/0062Z00000WdlzbQAB"
        },
        "Id": "0067Z00020WdlzbQAB",
        "AccountId": "00172000026uBNjQAM",
        "Account": {
            "attributes": {
                "type": "Account",
                "url": "/services/data/v60.0/sobjects/Account/0012Z000026uBNjQAM"
            },
            "Id": "001c2Z000026uBNjQAM"
        }
    }
]

Solution:

  • Create an integration procedure: IP

  • Make the IP call a dataraptor extract: Extract

Output

IP call

  • Use response action to fetch the data back to the calling component (in our case a Flexcard): Response

  • And lastly reference the integration procedure as the data source in your flexcard, edit JSON result path, and edit the datatable:

Data source settings

Datatable

Result:

Result

2
  • 1
    This worked! It took me a while to understand exactly how to pass the params from flex card to the IP, then from the IP DataRaptorExtract to ResponseAction. But after some testing and checking some youtube videos I got it. Thank you so much.
    – vio
    Commented Mar 29 at 11:44
  • 1
    @vio Glad you found a way how to do it. Cheers
    – DevelBase2
    Commented Apr 2 at 12:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .