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

Update() doesn't work as documented (for existing objects) #14

Closed
mtslzr opened this issue Nov 19, 2020 · 0 comments
Closed

Update() doesn't work as documented (for existing objects) #14

mtslzr opened this issue Nov 19, 2020 · 0 comments

Comments

@mtslzr
Copy link
Contributor

mtslzr commented Nov 19, 2020

The documentation and testing in the repo show Update() in the context of creating an empty object, using Create() to push it to Salesforce, then updating it. If you're working with already-existing objects (Contact, in my case), this does not work.

The following code:

contactObj := client.SObject("Contact").Get(contactID) // Pulls ALL the information on this Contact, as expected.
contactObj.Set("Email", newContactEmail) // Updates the email field, as expected.
contactObj.Update()

This returns a 400 from Salesforce, seemingly due to ALL the fields being passed. Guessing it might be related to #9 and/or #10, where more fields need to be omitted for Contact?

Was able to work-around it by creating an empty object, setting the ID and just the updated fields and running it:

contactObj := client.SObject("Contact")
contactObj.Set("Id", ContactID)
contactObj.Set("Email", newContactEmail)
contactObj.Update()

Not sure if it's just a matter of omitting some extra fields (Salesforce doesn't return much info on 400 other than it failed) or if Update() needs some tweaking (in general or Contact-specific).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant