0

How would i store this kind of JSON structure in salesforce?

"elementOne": [
  {
    "itemOne":"valueOne",
    "itemTwo":"valueTw0",
    "embeddedElementOne":{"embeddedItemOne":"embeddedValueOne"},
    "embeddedElementTwo":{"embeddedItemTwo":"embeddedValueTwo"}
   }
],
 "elementTwo":[
   {
     "secondElementOne":"Value",
     "secondEmbeddedElementOne":{"SomethingHere":"SomeValueHere"}
   }
]

If elementOne is Custom Object and itemOne, itemTwo are fields on that Object, what would embeddedElementOne will be? How and where to store that and how would send the same kind of structure when using POST method?

0

Your two objects, elementOne and elementTwo, would be related using lookup fields. For elementOne, it would be a lookup to elementOne (this is legal), and for elementTwo, it would have a lookup to elementOne as well. Depending on which API you decide to use (likely the sobject tree API or the nested records API), you would format your JSON according to the documentation, and the records would be inserted/updated appropriately.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.