You need to sign in to do that
Don't have an account?

How get value from JSON string and insert ?
Hello
I getting response in JSON body like
String JS = '[{"User": "12345","Statuses": [{ "EntityId": 123, "Status": "Success" },{ "EntityId": 456, "Status": "Fail" }]},{"User": "67891","Statuses": [{ "EntityId": 345, "Status": "InvalidEntity" },{ "EntityId": 456, "Status": "Success" },{ "EntityId": 456, "Status": "Fail" }]}]';
and I have custom object exception_c and it's two custom field ExceptionUser__c and ExceptionEntityId__c
How can i write logic for exception record insert in case only status fail ?
If status fail insert exception record associate user and entityId assosiate with failer responce?
I getting response in JSON body like
String JS = '[{"User": "12345","Statuses": [{ "EntityId": 123, "Status": "Success" },{ "EntityId": 456, "Status": "Fail" }]},{"User": "67891","Statuses": [{ "EntityId": 345, "Status": "InvalidEntity" },{ "EntityId": 456, "Status": "Success" },{ "EntityId": 456, "Status": "Fail" }]}]';
and I have custom object exception_c and it's two custom field ExceptionUser__c and ExceptionEntityId__c
How can i write logic for exception record insert in case only status fail ?
If status fail insert exception record associate user and entityId assosiate with failer responce?
http://www.tgerm.com/2011/10/winter12-jsonparser-serialize.html
Below is the salesforce documentation on JSON Parsing
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_json_jsonparser.htm
http://www.salesforce.com/us/developer/docs/dbcom_apex250/Content/apex_methods_system_jsonparser.htm