You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, love this package! I'm very grateful to the work you've put into this, it has helped me out immensely.
I'm trying to create campaign members for several campaigns via sf_create() (something I've done successfully before, by the way), but I'm getting an odd error message that says: Error: Column names errors.statusCode and errors.message must not be duplicated.
I tried it a few times, with both SOAP and REST, until I realized that some of the campaign members were being created with each pass since I didn't have all_or_none set to TRUE--but every time I get this error. I assume it's referring to the columns in the resultset table that is returned.
I've been working with salesforcer all afternoon, and have created new contacts and queried objects without problem until now.
To provide a little more info, I did try it with verbose = TRUE as well, and this is the bottom of that output, which was done in 3 batches:
Run `rlang::last_error()` to see where the error occurred.
> rlang::last_error()
x
+-<error/tibble_error_column_names_must_be_unique>
| Column names `errors.statusCode` and `errors.message` must not be duplicated.
\-<error/vctrs_error_names_must_be_unique>
Names must be unique.
Backtrace:
1. salesforcer::sf_create(...)
2. salesforcer:::sf_create_rest(...)
10. purrr::map_df(., flatten_tbl_df)
11. purrr::map(.x, .f, ...)
12. salesforcer:::.f(.x[[i]], ...)
6. rlist::list.flatten(.)
14. tibble::as_tibble_row(.)
22. tibble:::set_repaired_names(x, .name_repair)
24. tibble:::repaired_names(...)
27. vctrs::vec_as_names(...)
29. vctrs:::validate_unique(names = names, arg = arg)
30. vctrs:::stop_names_must_be_unique(names, arg)
31. vctrs:::stop_names(...)
32. vctrs:::stop_vctrs(class = c(class, "vctrs_error_names"), ...)
Run `rlang::last_trace()` to see the full context.
@Pecners Appreciate the heads up. Can you do me a favor and create the records one at a time by looping over the rows of your input tbl_df? I'd be curious to know what records and failing and why.
@Pecners Thanks again for pointing out the issue. The problem is that, for some reason, when the creation of a CampaignMember fails, two different error messages are returned, not just one. This means that I had to wrap the error in list() to have it be one single element to put into each row.
If you install from GitHub using remotes::install_github("StevenMMortimer/salesforcer"), the problem should be fixed. I'll probably release the package again on CRAN within the week before making a larger announcement about all the other added features. Appreciate the help in working out the kinks.
The example below shows how the new code will behave when you receive an error while creating records. In this case I have the Contact Ids, but I forgot to specify the Campaign Id.
library(dplyr, warn.conflicts=FALSE)
library(salesforcer)
sf_auth()
n<-3new_campaign_members<- tibble(CampaignId= rep("", n),
ContactId= c("0033s000013ZHX9AAO",
"0033s000013ZHXAAA4",
"0033s000013ZHXBAA4"),
Status= rep("Attended", n))
created_records<- sf_create(new_campaign_members, object_name="CampaignMember", api_type="REST")
created_records#> # A tibble: 3 x 2#> success errors #> <lgl> <list> #> 1 FALSE <list [2]> #> 2 FALSE <list [2]>#> 3 FALSE <list [2]>created_records$errors[1][[1]]
#> [[1]]#> [[1]]$statusCode#> [1] "REQUIRED_FIELD_MISSING"#> #> [[1]]$message#> [1] "Attempted to add a campaign member where either the member id '0033s000013ZHX9' or the campaign id 'null' is null."#> #> [[1]]$fields#> list()#> #> #> [[2]]#> [[2]]$statusCode#> [1] "REQUIRED_FIELD_MISSING"#> #> [[2]]$message#> [1] "Attempted to add a campaign member where either the member id '0033s000013ZHX9' or the campaign id 'null' is null."#> #> [[2]]$fields#> list()
First of all, love this package! I'm very grateful to the work you've put into this, it has helped me out immensely.
I'm trying to create campaign members for several campaigns via
sf_create()
(something I've done successfully before, by the way), but I'm getting an odd error message that says:Error: Column names errors.statusCode and errors.message must not be duplicated.
I tried it a few times, with both SOAP and REST, until I realized that some of the campaign members were being created with each pass since I didn't have
all_or_none
set toTRUE
--but every time I get this error. I assume it's referring to the columns in theresultset
table that is returned.I've been working with
salesforcer
all afternoon, and have created new contacts and queried objects without problem until now.To provide a little more info, I did try it with
verbose = TRUE
as well, and this is the bottom of that output, which was done in 3 batches:Running
rlang::last_error()
produces:And finally,
sessionInfo()
:The text was updated successfully, but these errors were encountered: