--- title: "Force.com Adapter Actions" slug: "forcecom-adapter-actions" description: "This is a list of actions that can be used in RapidIdentity Connect to interact with Force.com, a product of Salesforce." tags: ["RapidIdentity ", "Connect", "Adapter", "Actions", "Salesforce", "Force.com"] updated: 2022-06-03T17:48:00Z published: 2022-06-03T17:48:01Z canonical: "help.rapididentity.com/forcecom-adapter-actions" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.rapididentity.com/llms.txt > Use this file to discover all available pages before exploring further. # Force.com Adapter Actions ## Force.com Adapter Actions ### deleteForceComRecord Deletes the record in ForceCom. Returns a success boolean. | Property | Value | Description | | --- | --- | --- | | connection* | expression, variable | the ForceCom connection object | | id* | text, expression, variable | The Id of the ForceCom record to delete. | | returnVariable | expression, variable | name of the variable to be assigned to the return value | ```actionscript # Delete the incident if(incident){ deleted = deleteForceComRecord(sessionForce, newIncidentId) if(deleted){ log("incident deleted") } else { log("Unable to delete incident", "ERROR") } } else { } ``` ### deleteForceComRecords Deletes the records in ForceCom. Returns a result object containing the fields 'id','success', and 'errors', which are either single entries or arrays. | Property | Value | Description | | --- | --- | --- | | connection* | expression, variable | the ForceCom connection object | | ids* | text, expression, variable | The Ids of the ForceCom records to delete. | | returnVariable | expression, variable | name of the variable to be assigned to the return value | ```actionscript deleted = deleteForceComRecords(sessionForce, [idToDeleteA, idToDeleteB]) ``` ### getForceComRecord Gets a given ForceCom Record. | Property | Value | Description | | --- | --- | --- | | connection* | expression, variable | the ForceCom connection object | | objectType* | text, expression, variable | The ForceCom object type | | id* | text, expression, variable | The Id of the ForceCom record. | | returnVariable | expression, variable | name of the variable to be assigned to the return value | ```actionscript records = getForceComRecords(sessionForce, "Account", "Id, Name, OwnerId" ``` ### getForceComRecords Get multiple ForceCom Records matching the given filter, or all records if no filter is supplied. | Property | Value | Description | | --- | --- | --- | | connection* | expression, variable | the ForceCom connection object | | objectType* | text, expression, variable | The ForceCom object type | | filter | text, expression, variable | The filter used to limit results. Can either be an encoded query as specified by ForceCom, or a Record example object. | | fields | text, expression, variable | The fields returned in the query. Defaults to all fields. | | limit | expression, variable | The maximum number of records to return. Defaults to all objects. | | returnVariable | expression, variable | name of the variable to be assigned to the return value | ```actionscript records - getForceComRecords(sessionForce, "Account", query, "Id, Name, OwnerId") ``` ### openForceComConnection Opens a connection to a ForceCom Server. | Property | Value | Description | | --- | --- | --- | | username* | text, expression, variable | Username for authentication to the ForceCom web service | | password* | password, string, expression, variable | Password for authentication to the ForceCom web service. When authenticating through the API or client it is necessary to append the security token to the password in the form passwordSecurityToken. The security token is a case-sensitive, alphanumeric string and it can be obtained through the Salesforce UI Personal Settings through Reset Your Security Token or by changing the Salesforce password. | | apiVersion | text, expression, variable | API Version to use | | options | expression, variable | A record or JavaScript object with a field for each additional option. The currently defined fields are connectTimeout and socketTime which require a numeric value from 1 to 2147483647 (0x7FFFFFFF) that represents the number of milliseconds for the timeout, and 0 representing no timeout. | | returnVariable | expression, variable | name of the variable to be assigned to the return value | ```actionscript # Open Connections { sessionAD = openADConnection(Global.idautoHost, Global.idautoPort, Global.idautoSSL, Global.idautoUser, ) sessionForce = openForceComConnection(Global.forceUser, ) if(!sessionAD || !sessionForce){ # --- Error making connections. Terminating process. return null } else { } } ``` ### openForceComRecordIterator Open ForceCom Record Iterator. | Property | Value | Description | | --- | --- | --- | | connection* | expression, variable | the ForceCom connection object | | objectType* | text, expression, variable | The ForceCom object type | | filter | text, expression, variable | The filter used to limit results. Can either be an encoded query as specified by ForceCom, or a Record example object. | | fields | text, expression, variable | The fields returned in the query. Defaults to all fields. | | returnVariable | expression, variable | name of the variable to be assigned to the return value | ```actionscript records = openForceComRecordIterator(sessionForce, "Contact", filter) ``` ### saveForceComRecord Creates or updates the record in ForceCom. Returns the id of the object, or null on failure. | Property | Value | Description | | --- | --- | --- | | connection* | expression, variable | the ForceCom connection object | | record* | text, expression, variable | A Record object containing the fields you want to save. If 'Id' is set, an update will be performed, otherwise a create will be performed. | | returnVariable | expression, variable | name of the variable to be assigned to the return value | ```actionscript result = saveForceComRecord(sessionForce, recordForce) ``` ### saveForceComRecords Creates or updates multiple records in ForceCom. Returns a result object containing the fields 'id','success', and 'errors', which are either single entries or arrays. | Property | Value | Description | | --- | --- | --- | | connection* | expression, variable | the ForceCom connection object | | records* | text, expression, variable | An array of Record objects containing the fields you want to save. If 'Id' is set for a given Record, an update will be performed, otherwise a create will be performed. | | returnVariable | expression, variable | name of the variable to be assigned to the return value | ```actionscript results = saveForceComRecords(sessionForce, records) ``` ### Complete Example ```actionscript # open csv file containing new leads csvInput = openDelimitedTextInput("data/leads.csv", "FirstName,LastName,Email,Company") # open session to Force.com to access Salesforce app sessionSalesforce = openForceComConnection("user@example.com", , { socketTimeout: 10000 }) # loop through new leads forEach(csvRecord, csvInput) { # check for existing lead with same email address existing = getForceComRecords(sessionSalesforce, "Lead", { Email: "'" + csvRecord["Email"] + "'" }) if (existing & amp; & amp; existing[0]) { # lead exists, update the other fields record = createRecord(true) setRecordFieldValue(record, "type", "Lead") setRecordFieldValue(record, "Id", existing[0]["Id"]) copyRecordFields(csvRecord, record, "FirstName, LastName, Company") updatedId = saveForceComRecord(sessionSalesforce, record) if (updatedId) { log("Updated existing lead for: " + toJSON(csvRecord), "INFO") } else { log("Error updating existing lead for: " + toJSON(csvRecord), "ERROR") } } else { # lead doesn 't exist, so add record = createRecord(true) setRecordFieldValue(record, "type", "Lead") copyRecordFields(csvRecord, record, "FirstName, LastName, Email, Company") createdId = saveForceComRecord(sessionSalesforce, record) if (createdId) { log("Added new lead for: " + toJSON(csvRecord), "INFO") } else { log("Error updating existing lead for: " + toJSON(csvRecord), "ERROR") Go } } } close(sessionSalesforce) close(csvInput) ```