Class SObjectBatchResult

  • All Implemented Interfaces:
    Serializable

    public final class SObjectBatchResult
    extends Object
    implements Serializable
    Contains the individual result of Composite API batch request. As batch requests can partially succeed or fail make sure you check the getStatusCode() for status of the specific request. The result of the request can vary from API to API so here it is given as Object, in most cases it will be a Map with string keys and values or other Map as value. Requests are made in JSON format hold some type information (i.e. it is known what values are strings and what values are numbers).

    For example response for SObject record creation in JSON will be:

     {
       "statusCode": 201,
       "result": {
         "id" : "0010Y00000Ary8hQAB",
         "success" : true,
         "errors" : []
       }
     }
     

    Which will result in getResult() returning Map created like:

     {
         @code
         Map result = new HashMap<>();
         result.put("id", "0010Y00000Ary91QAB");
         result.put("success", Boolean.TRUE);
         result.put("errors", Collections.emptyList());
     }
     
    And that results in getResult() returning Map created like:
     {
         @code
         Map result = new HashMap<>();
    
         Map nestedResult = new HashMap<>();
         result.put("Result", nestedResult);
    
         nestedResult.put("id", "0010Y00000Ary91QAB");
         nestedResult.put("success", "true");
     }
     

    Note the differences between type and nested Map one level deeper in the case of XML.

    See Also:
    Serialized Form
    • Constructor Detail

      • SObjectBatchResult

        public SObjectBatchResult​(int statusCode,
                                  Object result)
    • Method Detail

      • getResult

        public Object getResult()
      • getStatusCode

        public int getStatusCode()