Multiple records parsing from JSON to salesforce apex | Post Service API | JSONParser in salesforce


In this post we are going to do POST Service API creation. First we will create the class which will parse the multiple Account records from JSON to apex list and then create the case and associate to that account which will match on the basis of Account name in existing salesforce database. We will use the JSONParser for that. You can read more about JSONParser from this link.
At the end there will be sample JSON data. To test in your system you can either change the name of given account name(wAccName) to your existing any account name or simply create an account with same name because it will only create the case for existing account which will match with this JSON record.
To pass the JSON you can use workbench.

Passing JSON data from workbench. Make sure path is correct
Sample JSON data
{
"AccountList": [
{
"wAccName": "Flipkart",
"wAccPhone": "88888"
},
{
"wAccName": "Amazon",
"wAccPhone": "99999"
}
]
}
Reactions

Post a Comment

0 Comments