sf_control: Auxiliary for Controlling Calls to Salesforce APIs

View source: R/utils-control.R

sf_controlR Documentation

Auxiliary for Controlling Calls to Salesforce APIs

Description

Typically only used internally by functions when control parameters are passed through via dots (...), but it can be called directly to control the behavior of API calls. This function behaves exactly like glm.control for the glm function.

Usage

sf_control(
  AllOrNoneHeader = list(allOrNone = FALSE),
  AllowFieldTruncationHeader = list(allowFieldTruncation = FALSE),
  AssignmentRuleHeader = list(useDefaultRule = TRUE),
  DisableFeedTrackingHeader = list(disableFeedTracking = FALSE),
  DuplicateRuleHeader = list(allowSave = FALSE, includeRecordDetails = FALSE,
    runAsCurrentUser = TRUE),
  EmailHeader = list(triggerAutoResponseEmail = FALSE, triggerOtherEmail = FALSE,
    triggerUserEmail = TRUE),
  LocaleOptions = list(language = "en_US"),
  MruHeader = list(updateMru = FALSE),
  OwnerChangeOptions = list(options = list(list(execute = TRUE, type =
    "EnforceNewOwnerHasReadAccess"), list(execute = FALSE, type = "KeepAccountTeam"),
    list(execute = FALSE, type = "KeepSalesTeam"), list(execute = FALSE, type =
    "KeepSalesTeamGrantCurrentOwnerReadWriteAccess"), list(execute = FALSE, type =
    "SendEmail"), list(execute = FALSE, type = "TransferAllOwnedCases"), list(execute =
    TRUE, type = "TransferContacts"), list(execute = TRUE, type = "TransferContracts"),
    list(execute = FALSE, type = "TransferNotesAndAttachments"),      list(execute =
    TRUE, type = "TransferOpenActivities"), list(execute = TRUE, type =
    "TransferOrders"), list(execute = FALSE, type = "TransferOtherOpenOpportunities"),
    list(execute = FALSE, type = "TransferOwnedClosedOpportunities"), list(execute =
    FALSE, type = "TransferOwnedOpenCases"), list(execute = FALSE, type =
    "TransferOwnedOpenOpportunities"))),
  QueryOptions = list(batchSize = 500),
  UserTerritoryDeleteHeader = list(transferToUserId = NA),
  BatchRetryHeader = list(`Sforce-Disable-Batch-Retry` = FALSE),
  LineEndingHeader = list(`Sforce-Line-Ending` = NA),
  PKChunkingHeader = list(`Sforce-Enable-PKChunking` = FALSE),
  api_type = NULL,
  operation = NULL
)

Arguments

AllOrNoneHeader

list; containing the allOrNone element with a value of TRUE or FALSE. This control specifies whether a call rolls back all changes unless all records are processed successfully. This control is available in SOAP, REST, and Metadata APIs for the following functions: sf_create, sf_delete, sf_update, sf_upsert, sf_create_metadata, sf_delete_metadata, sf_update_metadata, sf_upsert_metadata. For more information, read the Salesforce documentation here.

AllowFieldTruncationHeader

list; containing the allowFieldTruncation element with a value of TRUE or FALSE. This control specifies the truncation behavior for some field types in SOAP API version 15.0 and later for the following functions: sf_create, sf_update, sf_upsert. For more information, read the Salesforce documentation here.

AssignmentRuleHeader

list; containing the useDefaultRule element with a value of TRUE or FALSE or the assignmentRuleId element. This control specifies the assignment rule to use when creating or updating an Account, Case, or Lead for the following functions: sf_create, sf_update, sf_upsert. For more information, read the Salesforce documentation here.

DisableFeedTrackingHeader

list; containing the disableFeedTracking element with a value of TRUE or FALSE. This control specifies whether the changes made in the current call are tracked in feeds for SOAP API calls made with the following functions: sf_create, sf_delete, sf_update, sf_upsert. For more information, read the Salesforce documentation here.

DuplicateRuleHeader

list; containing the allowSave, includeRecordDetails, and runAsCurrentUser elements each with a value of TRUE or FALSE. This control specifies how duplicate rules should be applied when using the following functions: sf_create, sf_update, sf_upsert. For more information, read the Salesforce documentation here.

EmailHeader

list; containing the triggerAutoResponseEmail, triggerOtherEmail, and triggerUserEmail elements each with a value of TRUE or FALSE. This control determines if an email notification should be sent when a request is processed by SOAP API calls made with the following functions: sf_create, sf_delete, sf_update, sf_upsert, sf_reset_password. For more information, read the Salesforce documentation here.

LocaleOptions

list; containing the language element. This control specifies the language of the labels returned by the sf_describe_objects function using the SOAP API. The value must be a valid user locale (language and country), such as de_DE or en_GB. For more information, read the Salesforce documentation here. The list of valid user locales is available here.

MruHeader

list; containing the updateMru element with a value of TRUE or FALSE. This control indicates whether to update the list of most recently used items (TRUE) or not (FALSE) in the Recent Items section of the sidebar in the Salesforce user interface. This works for SOAP API calls made with the following functions: sf_create, sf_update, sf_upsert, sf_retrieve, sf_query. For more information, read the Salesforce documentation here.

OwnerChangeOptions

list; containing the options element. This control specifies the details of ownership of attachments and notes when a record’s owner is changed. This works for SOAP API calls made with the following functions: sf_update, sf_upsert. For more information, read the Salesforce documentation here.

QueryOptions

list; containing the batchSize element. This control specifies the batch size for query results . This works for SOAP or REST API calls made with the following functions: sf_query, sf_retrieve. For more information, read the Salesforce documentation here.

UserTerritoryDeleteHeader

list; containing the transferToUserId element. This control specifies a user to whom open opportunities are assigned when the current owner is removed from a territory. This works for the sf_delete function using the SOAP API. For more information, read the Salesforce documentation here.

BatchRetryHeader

list; containing the Sforce-Disable-Batch-Retry element. When you create a bulk job, the Batch Retry control lets you disable retries for unfinished batches included in the job. This works for most operations run through the Bulk 1.0 API (e.g. sf_create(., api_type = "Bulk 1.0")) or creating a Bulk 1.0 job with sf_create_job_bulk. For more information, read the Salesforce documentation here.

LineEndingHeader

list; containing the Sforce-Line-Ending element. When you’re creating a bulk upload job, the Line Ending control lets you specify whether line endings are read as line feeds (LFs) or as carriage returns and line feeds (CRLFs) for fields of type Text Area and Text Area (Long). This works for most operations run through the Bulk APIs and/or creating a Bulk job from scratch with sf_create_job_bulk. However, note that as of readr v1.3.1 all CSV files end with the line feed character ("\n") regardless of the operating system. So it is usually best to not specify this argument. For more information, read the Salesforce documentation here.

PKChunkingHeader

list; containing the Sforce-Enable-PKChunking element. Use the PK Chunking control to enable automatic primary key (PK) chunking for a bulk query job. This works for queries run through the Bulk 1.0 API either via sf_query(., api_type = "Bulk 1.0")) or sf_query_bulk. For more information, read the Salesforce documentation here.

api_type

character; one of "REST", "SOAP", "Bulk 1.0", or "Bulk 2.0" indicating which API to use when making the request.

operation

character; a string defining the type of operation being performed (e.g. "insert", "update", "upsert", "delete", "hardDelete", "query", "queryall").

Examples

## Not run: 
this_control <- sf_control(DuplicateRuleHeader=list(allowSave=TRUE, 
                                                    includeRecordDetails=FALSE, 
                                                    runAsCurrentUser=TRUE))
new_contact <- c(FirstName = "Test", LastName = "Contact-Create")
new_record <- sf_create(new_contact, "Contact", control = this_control)

# specifying the controls directly and are picked up by dots
new_record <- sf_create(new_contact, "Contact", 
                        DuplicateRuleHeader = list(allowSave=TRUE, 
                                                   includeRecordDetails=FALSE, 
                                                   runAsCurrentUser=TRUE))

## End(Not run)

salesforcer documentation built on March 18, 2022, 6:26 p.m.