Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note

Caveat Programmer!

updateQueryis an advanced request for custom/batch updates, and extreme care should be taken with its use

  • Does not perform processing of ValidationRules for the record(s) in question

  • Will not re-calculate and save formula fields for the record(s) in question

  • Will not re-calculate roll-up summary fields on parent object(s) records(s) for record(s) in question

  • It is possible to write values to the Db offline that will not sync cleanly to Salesforce or may damage your Salesforce instance when synced

  • It is possible to write values to the Db that will break functionality across the Pulsar app

var request = { "type" : "updateQuery", "object"
Code Block
Info

When Pulsar is in online mode, the updateQuery request will attempt to push the resulting database changes to your Salesforce instance. Responses to the updateQuery request will always reflect the success or failure of the local database query, even if the push to Salesforce has failed. In this situation, errors from Salesforce are reported as part of the success response (see example below), and the results of the query are maintained in the local database as offline changes.

Code Block
var request = { 
    "type" : "updateQuery",
    "object" : "Account",
    "data" : { "query" : "UPDATE Account SET ActiveCustomer__c = 'TRUE' WHERE OpportunityCount__c > 0;" }
};
bridge.sendRequest(request, function (responseData) { 
	alert('Javascript got its update query response: ' + responseData); 
});

Sample Response (with a reported Salesforce error):

Code Block
Response: {
    "type": "updateQueryResponse",
    "object": "Account",
    "data":  "datasuccess",
: {   "queryerrors" : "UPDATE[
Account SET ActiveCustomer__c = 'TRUE' WHERE OpportunityCount__c > 0;" }
};
bridge.sendRequest(request, function (responseData) { 
	alert('Javascript got its update query response: ' + responseData); 
});       {
            "errorCode": "ENTITY_IS_LOCKED",
            "message": "This record is locked. If you need to edit it, contact your admin."
        }
    ]
}