我正在使用 Mule ESB 3.4 CE。我有这个使用 Salesforce 连接器创建联系人的流程。我想解析错误并采取一些措施。
....
<sfdc:create config-ref="Salesforce" type="Contact" doc:name="Create Contacts">
<sfdc:objects ref="#[payload]"/>
</sfdc:create>
<expression-component doc:name="Get Successful List">flowVars.listSuccess = ($ in payload if $.success=='true')</expression-component>
<expression-component doc:name="Get Failed List">flowVars.listErrors = ($.errors in payload if $.success=='false')</expression-component>
结果如下:
[[SaveResult errors='{[1][Error fields='{[1]Email,}'
message='A contact with this email address already exists.'
statusCode='FIELD_CUSTOM_VALIDATION_EXCEPTION'
]
,}'
id='null'
success='false'
]
, [SaveResult errors='{[1][Error fields='{[1]Email,}'
message='A contact with this email address already exists.'
statusCode='FIELD_CUSTOM_VALIDATION_EXCEPTION'
]
,}'
id='null'
success='false'
]
]
我能够通过以下表达式组件获取 ID:
<expression-component doc:name="Get Failed List">flowVars.listIds = (Id in payload)</expression-component>
但是,如果出现错误,我无法查看 statusCode 和消息。我尝试了各种组合,但我无法得到它。例如 #[(message in (errors in flowVars.listErrors)]。当 Salesforce 返回错误时,如何获取 StatusCode 和消息?