Skip to contents

[Stable]

Searches for records in your organization’s data.

Usage

sf_search(
  search_string,
  is_sosl = FALSE,
  guess_types = TRUE,
  api_type = c("REST", "SOAP", "Bulk 1.0", "Bulk 2.0"),
  parameterized_search_options = list(...),
  verbose = FALSE,
  ...
)

Arguments

search_string

character; string to search using parameterized search or SOSL. Note that is_sosl must be set to TRUE and the string valid in order to perform a search using SOSL.

is_sosl

logical; indicating whether or not to try the string as SOSL

guess_types

logical; indicating whether or not to use col_guess() to try and cast the data returned in the recordset. If TRUE then col_guess() is used along with anytime() and anydate(). If FALSE then all fields will be returned as character. Specifying FALSE helpful when guessing the column data type will result in NA values and you would like to return the results as strings and then cast in your script according to your unique specifications.

api_type

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

parameterized_search_options

list; a list of parameters for controlling the search if not using SOSL. If using SOSL this argument is ignored.

verbose

logical; an indicator of whether to print additional detail for each API call, which is useful for debugging. More specifically, when set to TRUE the URL, header, and body will be printed for each request, along with additional diagnostic information where available.

...

arguments to be used to form the parameterized search options argument if it is not supplied directly.

Value

tibble

Note

The maximum number of returned rows in the SOSL query results is 2,000. Please refer to the limits HERE for more detail.

Examples

if (FALSE) { # \dontrun{
# free text search
area_code_search_string <- "(336)"
search_result <- sf_search(area_code_search_string)

# free text search with parameters
search_result <- sf_search(area_code_search_string,
                           fields_scope = "PHONE",
                           objects = "Lead",
                           fields = c("id", "phone", "firstname", "lastname"))

# using SOSL
my_sosl_search <- paste("FIND {(336)} in phone fields returning",
                        "contact(id, phone, firstname, lastname),",
                        "lead(id, phone, firstname, lastname)")
sosl_search_result <- sf_search(my_sosl_search, is_sosl=TRUE)
} # }