Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Offline persistence of formula field calculations

Please see previous discussion about formula fields and stale data.

To persist formula fields from the Javascript API, you must call calculateSaveFormulas.

var request = { 
    "type"   : "calculateSaveFormulas",
    "object" : "Some_Custom_Object__c", // the object type
    "data"   : {
        // optional list of objectIds (must be of the same object type as specified.
        "objectIds"     : [ "a025000000iW9YuAAK", "a0250000005thYuAnp" ],
        // optional where clause (additional way to select specific objects)
        "whereClause"   : "Type = 'Bodega' OR Type = 'Supermarket'",
        // optional list of specific formula fields to calculate. If you don't pass this parameter, it will calculate and save all formulas.
        "formulaFields" : [ "Total_Price__c", "Some_Other_Formula_Field__c" ]
    }
};
bridge.sendRequest(request, function (responseData) { alert('Javascript got its calculateSaveFormulas response: ' + responseData); });

WARNING: this can be an incredibly expensive and slow operation if you do not specify any filter criteria.  Therefore we recommend that you always include objectIds and/or whereClause parameters.

HTTP Callout API

The callout API is available for making HTTP(S) requests from the Pulsar platform and returning results to the HTML and javascript. Since custom HTML/javascript code is hosted as a local file within Pulsar, there can be issues using the normal XMLHttpRequest (XHR) or fetch methods to issue Cross-Origin requests to external services. This Pulsar API helps sidestep those problems.

  • No labels