I'm trying to use the composite graph API to associate a record to a parent using just a GET for the parent to get the ID.
My request looks like this
{
"graphs": [
{
"graphId": "graph1",
"compositeRequest": [
{
"method": "PATCH",
"referenceId": "opportunity",
"url": "/services/data/v55.0/sobjects/Opportunity/External_Id__c/8f0086e5-a1e0-40da-bbde-4cff20d61e8e",
"body": {
"Loan_Processor__c": "John Smith",
"Processing_Date__c": "2023-03-10",
"Processing_DateTime__c": "2023-03-10T20:09:00Z",
"Lock_Rate_Requested__c": true,
"Lock_Request_Base_Rate__c": 99.99,
"Lock_Request_Count__c": 4,
"Sell_Side_Investor_Phone__c": "925-467-9999"
}
},
{
"method": "GET",
"referenceId": "loanApplication1",
"url": "/services/data/v55.0/sobjects/Loan_Application__c/Application_Id__c/8f0086e5-a1e0-40da-bbde-4cff20d61e8e___borrower1"
},
{
"method": "PATCH",
"referenceId": "loanApplication1Employment1",
"url": "/services/data/v55.0/sobjects/Employment__c/Employment_External_ID__c/8f0086e5-a1e0-40da-bbde-4cff20d61e8e___568438598",
"body": {
"Loan_Application__c": "@{loanApplication1.id}",
"Employer_Name__c": "Salesforce"
}
}
]
}
]
}
This gives me back an error:
Invalid reference specified. No value for loanApplication1.id found in loanApplication1. Provided referenceId ('loanApplication1.id') must start with a letter or a number, and it can contain only letters, numbers and underscores ('_').
However, if I change the 2nd composite request from a GET to a PATCH it works as long as I set a body.
So this request works:
{
"graphs": [
{
"graphId": "graph1",
"compositeRequest": [
{
"method": "PATCH",
"referenceId": "opportunity",
"url": "/services/data/v55.0/sobjects/Opportunity/External_Id__c/8f0086e5-a1e0-40da-bbde-4cff20d61e8e",
"body": {
"Loan_Processor__c": "John Smith",
"Processing_Date__c": "2023-03-10",
"Processing_DateTime__c": "2023-03-10T20:09:00Z",
"Lock_Rate_Requested__c": true,
"Lock_Request_Base_Rate__c": 99.99,
"Lock_Request_Count__c": 4,
"Sell_Side_Investor_Phone__c": "925-467-9999"
}
},
{
"method": "PATCH",
"referenceId": "loanApplication1",
"url": "/services/data/v55.0/sobjects/Loan_Application__c/Application_Id__c/8f0086e5-a1e0-40da-bbde-4cff20d61e8e___borrower1",
"body": {
"Borrower_First_Name__c": "Bob"
}
},
{
"method": "PATCH",
"referenceId": "loanApplication1Employment1",
"url": "/services/data/v55.0/sobjects/Employment__c/Employment_External_ID__c/8f0086e5-a1e0-40da-bbde-4cff20d61e8e___568438598",
"body": {
"Loan_Application__c": "@{loanApplication1.id}",
"Employer_Name__c": "Salesforce"
}
}
]
}
]
}
The only thing I changed was the GET to a PATCH and added a body only because it's required.
I don't want to do a PATCH for the 2nd request (the Loan_Application__c object) because I don't need to update it. I just want to do a GET so I can use the id
in the 3rd request to associate the Employment__c
to it's parent Loan_Application__c
.
What am I missing?
UPDATE: I discovered that the property for the id is case sensitive. If the 2nd request is a GET the reference in the 3rd request has to be @{loanApplication1.Id}
but if the 2nd request is a PATCH the reference in the 3rd request has to be @{loanApplication1.id}
. Notice the difference of the capital I
in Id
vs the lower case i
in id
.
I'm not sure why this happens or if there is any way to resolve it.