How to retrieve related record details in GET REST Method?

Hi everyone.

I am making the following query:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
"filter": [
{
"$and": [
{
"send_to_dimensions_c" : 1
},
{
"a_project_code" : {"$is_null": "a_project_code"}
}
]
}
],
"fields": [
"id",
"name",
"database_c",
"team_id",
"account_id",
"account_name",
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Against the URL:
URL/.../filter
I want the grab the field "database_c" from the linked account (Many to One relationship so only one), but whenever I query like the above it just returns:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"accounts": {
"name": "Supplier Test 2",
"id": "8199432e-4ed6-11ed-9c81-00163ef40625",
"_acl": {
"fields": {
"business_center_name": {
"create": "no",
"write": "no",
"license": "no"
},
"business_center_id": {
"create": "no",
"write": "no",
"license": "no"
}
},
"_hash": "e376f7492abb281a71d6a0860441877a"
}
},
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
But doesn't add the field I've referenced. Has anyone been able to do this? I'd rather not do a second call to the account ID to get the data if possible.
Thanks,

Daniel
Parents
  • It is a while since I did any calls that returned specific related fields but I believe (and so does the official documentation) that it is possible to do what you are attempting.

    However, in your snippet you seem to have done a direct copy-and-paste from the docs and simply changed the field names required. You have left in the "order_by" from the original that references a field "date_closed" that is not on Accounts. I think the original was an example from Opportunities.

    Can you take out the "order_by" part (or change it to a field that is on the Account object) and see what that returns?

    Thanks,

    JH.

  • Hi John. Thanks for the response, updating it to be:

        "fields": [
            "id",
            "name",
            "send_to_dimensions_c",
            "dimensions_database_c",
            "team_id",
            "account_id",
            "account_name",
            "amount",
            "opportunity_type",
            "sales_stage",
            {"name":"accounts","fields":["id","name","phone_office"]}
        ],
    Still returns the same :(
  • Daniel,

    You removed the "database_c" field from your field list, isn't that the field you wanted?

Reply Children
No Data