Describe the problem/error/question
Hello everyone, I am receiving a response from a webhook, that can be different every times
Example 1:
soapenv:envelope
$
xmlns:soapenv:http://schemas.xmlsoap.org/soap/envelope/
xmlns:xsd:http://www.w3.org/2001/XMLSchema
xmlns:xsi:http://www.w3.org/2001/XMLSchema-instance
soapenv:body
notifications
$
xmlns:http://soap.sforce.com/2005/09/outbound
organizationid:00D1a5012312300000EueFEAS
actionid:04k4R00das0000123123H57lQAC
sessionid
$
xsi:nil:true
enterpriseurl:https://te.my.salesforce.com/services/Soap/c/58.0/dasdasd
partnerurl:https://test.my.salesforce.com/services/Soap/u/58.0/dasd
notification
0
id:04lUR00012312312001Q6u2YAC
sobject
$
xsi:type:sf:Lead
xmlns:sf:urn:sobject.enterprise.soap.sforce.com
sf:id:00QUR0000028mSw2AI
sf:ava__avaai_action_required__c:false
sf:ava__avaai_further_action__c:false
sf:ava__avaai_hot_lead__c:false
etc...
Example 2:
soapenv:envelope
$
xmlns:soapenv:http://schemas.xmlsoap.org/soap/envelope/
xmlns:xsd:http://www.w3.org/2001/XMLSchema
xmlns:xsi:http://www.w3.org/2001/XMLSchema-instance
soapenv:body
notifications
$
xmlns:http://soap.sforce.com/2005/09/outbound
organizationid:00D15012300000EueFEAS
actionid:04k4R0001231000H57lQAC
sessionid
$
xsi:nil:true
enterpriseurl:https://test.my.salesforce.com/services/Soap/c/58.0/00D15000000EueF
partnerurl:https://test.my.salesforce.com/services/Soap/u/58.0/00D15000000EueF
notification
id:04lUR000001Q8MLYA0
sobject
$
xsi:type:sf:Lead
xmlns:sf:urn:sobject.enterprise.soap.sforce.com
sf:id:00QUR0000028fpe2AA
sf:ava__avaai_action_required__c:false
sf:ava__avaai_further_action__c:false
sf:ava__avaai_hot_lead__c:false
sf:ava__avaai_lead_at_risk__c:false
sf:ava__avaai_sms_opt_out__c:false
etc...
So as you can see the difference is that sometimes the item ânotificationâ contain an array and sometimes no
What is the error message (if any)?
The error is, how to handle this:
I am using a âItem Listâ Operation âconcatenate itemsâ aggregate âindividual fieldsâ for obtain the âSF:IDâ value
With the âexample 2â this is working:
body.soapenv:envelope.soapenv:body.notifications.notification.sobject.sf:id
But not with the âexample 1â,
Is there an expression that allow me to cover both scenario?
Smtg like this:
{{$json[âbodyâ][âsoapenv:envelopeâ][âsoapenv:bodyâ][ânotificationsâ][ânotificationâ].sobject[â$â][âsf:idâ] || $json.body[âsoapenv:envelopeâ][âsoapenv:bodyâ].notifications.notification[0].sobject[â$â][âsf:idâ]}}
Please share your workflow
My tries:
Iâve tried this expression but return me âundefinedâ
$json.body[âsoapenv:envelopeâ][âsoapenv:bodyâ].notifications.notification[0].sobject[â$â][âsf:idâ]
Share the output returned by the last node
Information on your n8n setup
- n8n version: 0.234.1
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app): self-hosted
- Operating system: