sf_update_metadata {salesforcer} | R Documentation |
Update Object or Field Metadata in Salesforce
Description
This function takes a list of Metadata components and sends them to Salesforce to update an object that already exists
Usage
sf_update_metadata(
metadata_type,
metadata,
control = list(...),
...,
all_or_none = deprecated(),
verbose = FALSE
)
Arguments
metadata_type |
|
metadata |
|
control |
|
... |
arguments passed to |
all_or_none |
|
verbose |
|
Value
A tbl_df
containing the creation result for each submitted metadata component
Note
The update key is based on the fullName parameter of the metadata, so updates are triggered when an existing Salesforce element matches the metadata type and fullName.
See Also
Examples
## Not run:
# create an object that we can update
base_obj_name <- "Custom_Account1"
custom_object <- list()
custom_object$fullName <- paste0(base_obj_name, "__c")
custom_object$label <- paste0(gsub("_", " ", base_obj_name))
custom_object$pluralLabel <- paste0(base_obj_name, "s")
custom_object$nameField <- list(displayFormat = 'AN-{0000}',
label = paste0(base_obj_name, ' Number'),
type = 'AutoNumber')
custom_object$deploymentStatus <- 'Deployed'
custom_object$sharingModel <- 'ReadWrite'
custom_object$enableActivities <- 'true'
custom_object$description <- paste0(base_obj_name, " created by the Metadata API")
custom_object_result <- sf_create_metadata(metadata_type = 'CustomObject',
metadata = custom_object)
# now update the object that was created
update_metadata <- custom_object
update_metadata$fullName <- 'Custom_Account1__c'
update_metadata$label <- 'New Label Custom_Account1'
update_metadata$pluralLabel <- 'Custom_Account1s_new'
updated_custom_object_result <- sf_update_metadata(metadata_type = 'CustomObject',
metadata = update_metadata)
## End(Not run)