0

I'm trying to execute the following compositeRequest but I'm getting the error.

{
  "allOrNone": true,
  "compositeRequest": [
    {
      "method": "GET",
      "url": "/services/data/v46.0/query/?q=SELECT+id,Name+FROM+Contact+WHERE+Email+=+'test@gmail.com'",
      "referenceId": "refContactData"
    },{
      "method": "PATCH",
      "url": "/services/data/v46.0/sobjects/Case/5005O000000s7XXXX",
      "referenceId": "refCase",
      "body": {
        "Subject":"test",
        "ContactId": "@{refContactData.records[0].id}"
      }
    }
  ]
}

Second is getting failed and it is throwing an error.

Error:

  {
            "body": [
                {
                    "errorCode": "PROCESSING_HALTED",
                    "message": "Invalid reference specified. No value for refContactData.records[0].id found in refContactData"
                }
            ],
            "httpHeaders": {},
            "httpStatusCode": 400,
            "referenceId": "refCase"
        }

Kindly please let me know If I have missed any componet.

  • Based on the email I have verified that contact is available in my org. – Ramesh S Sep 17 at 12:32
1

You have a capitalization error:

@{refContactData.records[0].id}

In the response body to a Query REST call, each record contains a field called Id, not id:

  "records" : [ {
    "attributes" : {
      "type" : "Contact",
      "url" : "/services/data/v46.0/sobjects/Contact/0031R000025XXXXQAA"
    },
    "Id" : "0031R000025XXXXQAA"
  },

I was able to execute a composite request analogous to yours simply by using

@{refContactData.records[0].Id}
  • David Reed, It is working fine. Thank you. – Ramesh S Sep 18 at 2:57

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.