AnsweredAssumed Answered

How to Dynamically Upsert, create and delete Salesforce Parameter records?

Question asked by venkatesh.siva821054 on Jul 27, 2017
Latest reply on Jul 29, 2017 by Srinivas Chandrakanth Vangari

Im trying to dump JSON attribute data onto Salesforce. This process will run once daily-

But the requirement has a few conditons added -

1) On Initial load if JSON attribute value is NULL ,then “ DO NOT CREATE Salesforce Parameter record” only for that attribute ELSE create a SF parameter and insert JSON attribute value onto the Parameter record. .
2) During Second, third  and upcoming future loads, make sure that-
a) If a new JSON attribute appears in source file, then create a Salesforce parameter Record and insert data.
b) If value of an previously existing JSON attribute changes, then update it in the Salesforce Parameter previously created during prior loads.
c) If a previously existing JSON attribute does not exist in the source file (or) if JSON attributes value is given NULL, then DELETE the Salesforce parameter previously created during prior loads.

 

Example JSON Data File-

{
"WSSummaryAllSitesResult": [{
"CPUModel": "Qualcomm Snapdragon 835",
"CPUSpeed": "11112.00 GHz",
"Hostname": "amazon.com",
"LicensePCSN": null,
"MacAddresses": ["34:17:EB:CF:40:FD"],
"OSServicePack": "xxxxxxxx1",
"OSVersion": "Android",
"RAM": "31 xx",
"SCAssetId": null,
"ServiceTag": "DWYVS22",
"SiteId": "2fe9598e-5188-4f19-8b4b-5aa692d1ffb4",
"VersionTags": [{
"ProductName": "AasA ROy",
"xxxxxx": "zzzzzzz"
}],
"WSTypeTags": ["Eclipse Calc. Workstation"]
}]
}

 

New attributes may get added up or deleted in future and also the attributes value may get changed to a different value or NULL

Outcomes