1

Is there a way to reference a record type by name in tree requests?

My example payload:

{
    "records": [
        {
            "LastName": "Doe",
            "RecordType": { 
                "attributes": { 
                    "sobjectType": "RecordType" 
                 }, 
                 "Name": "Employee" 
            }
            "attributes": {
                "type": "Account",
                "referenceId": "ref1"
            }
        }
    ]
}

However, the API responses with an error:

{
    "hasErrors": true,
    "results": [
        {
            "referenceId": "ref1",
            "errors": [
                {
                    "statusCode": "INVALID_FIELD",
                    "message": "Cannot reference a foreign key field RecordType.",
                    "fields": []
                }
            ]
        }
    ]
}

Note: This question is closely related to Composite Api Objects and Referencing RecordTypes. Although stated in the accepted answer, the solution obviously does not work for tree requests, but for composite requests only.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.