Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to update records with NULL values #29

Closed
ghareesh opened this issue Jul 25, 2019 · 2 comments
Closed

Not able to update records with NULL values #29

ghareesh opened this issue Jul 25, 2019 · 2 comments
Assignees
Labels
bug Unintended behavior that should be corrected question or help Clarification or help may suffice to resolve
Milestone

Comments

@ghareesh
Copy link

Hi,
Have 2 issues using package while updating null values with sf_update function..
Ex: sf_update(test,"Case")

  1. While trying to write back NA date values
    When NA(formatted as date) values is to be written back, it shows following error..

HTTP error 500 on attempt 1 ...
backing off 1.00 seconds, retrying
HTTP error 500 on attempt 2 ...
backing off 3.00 seconds, retrying
HTTP error 500 on attempt 3 ...
backing off 0.56 seconds, retrying
HTTP error 500 on attempt 4 ...
backing off 6.10 seconds, retrying
Error in catch_errors(httr_response) :
'NA' is not a valid value for the type xsd:date

While using createBulkBatch method , this was smooth. But we cannot continue using bulk updates due to salesforce restrictions for number of bulk operations per day in our org.

  1. When Null values to be updated to picklist fields
    While using createBulkBatch updates, Null value written back will delete the existing values in the picklist field.
    Example:
    Before write back :
    Substatus = "Waiting for AI process"
    After writing back NA value,
    Substatus will be blank. History of record will say the substatus is deleted.

But while using sf_update, the "NA" value is getting written back. Is there a way to make this to be delete of existing value than writing back "NA" as a value?

Thanks a lot for all your support..

@StevenMMortimer
Copy link
Owner

Below is an example of how to update a field. You need to specify the api_type="REST" because that currently supports the functionality you want. I just added it for the SOAP API as well, so you will have to re-install from GitHub if you want to use the SOAP API in the way you are calling as sf_update(test, 'Contact') which uses the SOAP API by default.

library(tidyverse)
library(salesforcer)
sf_auth()

contact_to_update <- tibble(Id = "0036A00000aABCnZZZ", Field1 = NA_character_)
result <- sf_update(contact_to_update, "Contact", api_type="REST")
result

@ghareesh
Copy link
Author

Great Steven.. Thanks a ton ton for this.. Really helps a lot and you made my day.. Respect!!

@StevenMMortimer StevenMMortimer self-assigned this Jul 25, 2019
@StevenMMortimer StevenMMortimer added bug Unintended behavior that should be corrected question or help Clarification or help may suffice to resolve labels Jul 25, 2019
@StevenMMortimer StevenMMortimer added this to the 0.1.4 milestone Jul 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unintended behavior that should be corrected question or help Clarification or help may suffice to resolve
Projects
None yet
Development

No branches or pull requests

2 participants