I am having multiple records and need to push each records to Salesforce. Can anyone help me to achieve this requirement?
INPUT REQUEST:
[
{
"Lead Source":"LDV Facebook - Book a Test Drive",
"Preferred Model":"T60 4WD Diesel Dual Cab Ute",
"Email":"Test1@bigpond.com",
"Postal Code":"4211",
"Enquiry Date":"27-03-20",
"Date Sent":"01-04-20",
"Mobile":"+61 414 994 774",
"Name":"Stephen Ross",
"Dealer":"QLD -Von Bibra Gold Coast - 554216"
},
{
"Lead Source":"LDV i-Motor - Get a Quote",
"Preferred Model":"T60 4WD Diesel Dual Cab Ute",
"Email":"Test2@gmail.com",
"Postal Code":"4209",
"Enquiry Date":"27-03-20",
"Date Sent":"01-04-20",
"Mobile":"+61 423 927 999",
"Name":"Jaxon",
"Dealer":"QLD - Von Bibra Gold Coast - 554216"
},
{
"Lead Source":"LDV i-Motor - Get a Quote",
"Preferred Model":"T60 4WD Diesel Dual Cab Ute",
"Email":"Test3@hotmail.com",
"Postal Code":"4209",
"Enquiry Date":"28-03-20",
"Date Sent":"01-04-20",
"Mobile":"+61 447809 834",
"Name":"Brendan Dunleavy",
"Dealer":"QLD - Von Bibra Gold Coast - 554216"
}
]
Proxy Code:
<iterate expression="//jsonArray/jsonElement" id="LDVid" sequential="true">
<target>
<sequence>
<property description="incomingRequest" expression="$body/*" name="incomingRequest" scope="default" type="OM"/>
<!-- Business process related sequence -->
<sequence key="ProcessSequence"/>
</sequence>
</target>
</iterate>
Note :
Here i can't able to fetch each json element by below technique.
<property description="Email" expression="$ctx:incomingRequest//*[local-name()='Email']/text()" name="Email" scope="default" type="STRING"/>
I met my requirement, now i can send multiple records to Salesforce one by one by using Iterator.
<iterate expression="//jsonArray/jsonElement" id="LDVid" sequential="true">
<target>
<sequence>
<sequence description="ProcessSequence" key="ProcessSequence"/>
</sequence>
</target>
</iterate>
<property name="Aggregated_Responses" scope="default">
<jsonObject/>
</property>
<aggregate id="LDVid">
<completeCondition>
<messageCount max="-1" min="-1"/>
</completeCondition>
<onComplete enclosingElementProperty="Aggregated_Responses" expression="$body/*[1]" xmlns:ns="http://org.apache.synapse/xsd">
<log description="***aggregated***" separator="***aggregated***">
<property expression="$ctx:Aggregated_Responses" name="Aggregated_Responses"/>
</log>
<send/>
</onComplete>
</aggregate>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.