Skip to main content
Skip table of contents

Salesforce JavaScript API Functions

Supported Platforms:

  • Pitcher Impact iOS

  • Pitcher Impact Android

  • Pitcher Impact Windows

  • Pitcher Connect

 This article is currently being developed. We will expand on how to use more SFDC integration functions in interactive content. 

Searching the Offline Encrypted Database 

Note: 'source' parameter is required for only iOS.

currentAccountID can be accesses from getInfo or getParameters function depending on the interactive content type you are developing.

source can be either "modal" for zip interactive or "presentation" for presentation interactive content types. This is needed for the callback function to be fired up in the correct content view.

JS
function getCustomObjectRelatedToAccount(accountID,source){   
Ti.App.fireEvent("searchDB",
    {"objectType":"customObject__c","keyword":currentAccountID,
    "callBack":"gotCustomObject","source":source});}

function gotCustomObject(params){      
var parsedParams = JSON.parse(params);    
console.log(parsedParams);}

Creating and Updating New Values on SFDC in an Offline Environment

 If the device is online, create/update calls goes as soon as possible, if the device is not online, these calls are saved and gets synced on the first online presence.

CODE
function createCustomObject(){    
var fieldsCustomObject = {};

    fieldsCustomObject.objectType = "customObject__c";

    fieldsCustomObject.CustomObject_Name__c = "Sample Value";    
    fieldsCustomObject.CustomObject_Use__c = "Sample Value";

    console.log(fieldsCustomObject);

    Ti.App.fireEvent('sendStatsFromHTML',
{'event_name':'event_redirect_createSFDC','event_params':fieldsCustomObject});}

 

updateCustomObject function requires an id parameter value of an existing customobject entry to update.

 

function updateCustomObject(sfdcid){    
var fieldsCustomObject = {};

    fieldsCustomObject.Id = sfdcid; 

    fieldsCustomObject.objectType = "customObject__c";

    fieldsCustomObject.CustomObject_Name__c = "Sample Value";    
    fieldsCustomObject.CustomObject_Use__c = "Sample Value";

    console.log(fieldsCustomObject);

    Ti.App.fireEvent('sendStatsFromHTML',{'event_name':'event_redirect_updateSFDC','event_params':fieldsCustomObject});}
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.