Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

"CRUD" Request Types

Read

Read object data from the database. This API will filter the objects based on the field names and values in the data portion of the request. There is no way to limit the fields returned by this API, so full object data will always be returned.

...

Code Block
var request = { 
    "type" : "select",
    "object" : "Account",
    "data" : { "query" : "Select Id from Account Where Name like '%hello%'" }
};
bridge.sendRequest(request, function (responseData) {
    alert('Javascript got its select response: ' + responseData);
});

Update (local update query)

Info

We encourage you to use the standard CRUD updaterequest, (see above).  The updateQueryrequest allows developers to issue a raw UPDATE to the local database.

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."
        }
    ]
}