Am migrating an existing Mule 3 application to Mule 4 .
In one of the flows we interact with salesforce
( Mule 3 code below ) :
<sfdc-composite:execute-composite-request config-ref="SFC" allOrNone="true" doc:name="Retrieve Composite"/>
The request payload in Mule 3 is :
{
{method=GET, url=/services/data/v43.0/query/?q=select xyz ..., referenceId=studentExtId}
{method=PATCH, url=/services/data/v43.0/sobjects/Student/@{studentId}, body={name=ABC}, refId=studentUpdate}
}
Note - this mule 3 is an existing api in production running fine . It returns a error response as:
compositeResponse=[{body=[{errorCode=PROCESSING_HALTED, message=
The transaction was rolled back since another operation in the same transaction failed.}],
httpHeaders={}, httpStatusCode=400, referenceId=studentExtId},
{body=[{errorCode=PROCESSING_HALTED, message=Invalid reference specified.
No value for Student found in studentExtId.
Provided referenceId ('Student') must start with a letter or a number,
and it can contain only letters, numbers and underscores ('_').}], httpHeaders={},
httpStatusCode=400, referenceId=studentUpdate}]
I would expect the same response in mule 4 but its different . Here is the mule 4 code :
<salesforce-composite:execute-composite-request doc:name="composite request" config-ref="Composite_Config"/>
Request to SF :
{
"compositeRequest": [
{
"method": "GET",
"url": "/services/data/v43.0/query/?q=select xyz ...",
"referenceId": "studentExtId"
},
{
"method": "PATCH",
"url": "/services/data/v43.0/sobjects/Student/@{studentId}, body={name=ABC}, refId=studentUpdate}
}
]
}
Here is the response in Mule 4 :
{
"compositeResponse": [
{
"body": {
"totalSize": 0,
"done": true,
"records": [
]
},
"httpHeaders": {
},
"httpStatusCode": 200,
"referenceId": "studentExtId"
},
{
"body": [
{
"errorCode": "PROCESSING_HALTED",
"message": "Invalid reference specified.
No value for Student found in studentExtId. Provided referenceId ('Student') must start with a
letter or a number, and it can contain only letters, numbers and underscores ('_')."
}
],
"httpHeaders": {
},
"httpStatusCode": 400,
"referenceId": "studentUpdate"
}
]
}
so in case of Mule 3 the response is a 400 for both calls while in case of Mule 4 the first ( GET ) call is showing as success ( 200 ) while the second call is showing as error ( 400 )
I am new to Salesforce , so not sure if mule composite request behaves this way and if this is expected ? Just want to know why this difference ? Thanks
Mule 3 and Mile 4 are not compatible. Morover Mule 4 connectors use a different design and we're rewritten from scratch. It is to be expected that they behave somewhat differently. You should read the documentation for both to understand the differences in behavior.
In this case it seems that the Mule 4 version returns separate responses for each sub operation in the request while the Mule 3 returns a combined one.