I have one requirement like if InsurancePolicy record with Policy_External_Id__c is already in salesforce then it should update that one else insert so for this I used Patch method below was my request body
{ "compositeRequest": [ { "method": "PATCH", "url": "/services/data/v50.0/sobjects/InsurancePolicy/Policy_External_Id__c/test-ID3124", "referenceId": "newPolicy", "body": { "Primary_Traveler_FirstName__c": "zy", "Primary_Traveler_LastName__c": "test", "Primary_Traveler_Birthdate__c": "1973-01-01", "ServicingOfficeStreet": "111 Main St", "ServicingOfficeCity": "surat", "ServicingOfficeState": "MA", "ServicingOfficePostalCode": "01002", "EffectiveDate": "2025-08-20", "ExpirationDate": "2025-10-20", "Name": "FIX203766", "Product": { "Product_External_Id__c": "Toi-F" }, "Email__c": "[email protected]", "Destination_Country__c": "USA", "Destination_State__c": "Arizona", "Phone__c": "123-456-789", "Airline_Account__r": { "Account_External_Id__c": "xyz-360" }, "Cruiseline_Account__c": null, "Tour_Operator_Account__c": null, "Customer_Care_Attribution__c": "ID3124", "NameInsured": { "Account_External_Id__c": "xyz-360" } } }, { "method": "POST", "url": "/services/data/v50.0/sobjects/Traveler__c", "referenceId": "traveler1", "body": { "First_Name__c": "xyy", "Last_Name__c": "test", "Birthdate__c": "1990-02-04", "Related_Policy__c": "@{newPolicy.id}" } }, { "method": "POST", "url": "/services/data/v50.0/sobjects/Traveler__c", "referenceId": "traveler2", "body": { "First_Name__c": "testing", "Last_Name__c": "name", "Birthdate__c": "2014-04-05", "Related_Policy__c": "@{newPolicy.id}" } }, { "method": "POST", "url": "/services/data/v50.0/sobjects/InsurancePolicyCoverage", "referenceId": "insuranceCoverage", "body": { "CoverageName": "Cancel", "LimitAmount": 1, "LimitPercentage": 2, "Description": "Testing coverage description", "PremiumAmount": 20, "InsurancePolicyId": "@{newPolicy.id}", "Code__c": "cancelForAnyReason" } } ] } below error i am getting as a response
{ "compositeResponse": [ { "body": [ "/services/data/v50.0/sobjects/InsurancePolicy/001Wr000006OBRQIA4", "/services/data/v50.0/sobjects/InsurancePolicy/001Wr000006KC3sIAG" ], "httpHeaders": {}, "httpStatusCode": 300, "referenceId": "newPolicy" }, { "body": [ { "errorCode": "PROCESSING_HALTED", "message": "Execution halted as previous operation (newPolicy) was not successful." } ], "httpHeaders": {}, "httpStatusCode": 400, "referenceId": "traveler1" }, { "body": [ { "errorCode": "PROCESSING_HALTED", "message": "Execution halted as previous operation (newPolicy) was not successful." } ], "httpHeaders": {}, "httpStatusCode": 400, "referenceId": "traveler2" }, { "body": [ { "errorCode": "PROCESSING_HALTED", "message": "Execution halted as previous operation (newPolicy) was not successful." } ], "httpHeaders": {}, "httpStatusCode": 400, "referenceId": "insuranceCoverage" } ] } can anyone help me to resolve this