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

Better handling for Salesforce fields that are required #189

Closed
jonathanstegall opened this issue Jun 25, 2018 · 3 comments · Fixed by #228
Closed

Better handling for Salesforce fields that are required #189

jonathanstegall opened this issue Jun 25, 2018 · 3 comments · Fixed by #228
Labels
bug Something isn't working enhancement New feature or request fix needs review A fix is in and it needs further testing help wanted Other developer help would be great
Milestone

Comments

@jonathanstegall
Copy link
Member

Expected behavior

I think it's reasonable to assume that if you can map a WordPress field to a Salesforce field, it should not fail based on meta fields that aren't populated until after the record is created.

Actual behavior

The plugin doesn't differentiate required fields or meta fields at this time.

Steps to reproduce behavior

For example, if the plugin allows you to map a user to an account, but the user field that you want to map to the account name is a user meta field, you probably shouldn't be able to map it that way.

I don't know if this is an issue we can reasonably deal with in this plugin. Maybe it's a documentation issue. But it's at least worth thinking about.

@jonathanstegall jonathanstegall added the enhancement New feature or request label Nov 2, 2018
@jonathanstegall
Copy link
Member Author

jonathanstegall commented Jan 23, 2019

There are at least some cases where this can be super confusing. For example:

  1. User maps Opportunity to Post.
  2. User creates a new post that has all the required fields to create a new opportunity.
  3. The opportunity will fail if any required fields are meta fields. Like in our case with StageName, if there's a custom field called StageName it will not be sent on the initial post creation.

But then it gets dumb because the plugin tries to update a record that doesn't exist and it creates various error logs.

What should probably happen in this case is some combination of:

Ideal

Perhaps the plugin would uniquely save the fail status of the create operation somewhere rather than creating an error log. So it would understand that it failed to create a post because the meta fields were missing. Then when the meta fields were added on a post update operation, it would try again to create the opportunity in Salesforce, since it would have all of the data.

Not as good but still decent

When users map the fields, if they try to map a meta field to a Salesforce require field, the WordPress create trigger would be disabled and it would show them a message.

Not ideal but better than the current state

The plugin would fail to create a record in Salesforce when it was created in WordPress, but it would not try to update a non-existent record. There would only be one error log entry.

@jonathanstegall jonathanstegall added the bug Something isn't working label Jan 23, 2019
@jonathanstegall
Copy link
Member Author

Of course this is all related to #119, which is kind of the bane of this plugin's existence.

@jonathanstegall jonathanstegall modified the milestones: v2.0.0, v1.7.0 Jan 23, 2019
@jonathanstegall jonathanstegall added the help wanted Other developer help would be great label Jan 23, 2019
@jonathanstegall
Copy link
Member Author

Note: the REST API response from Salesforce has a "nillable" flag on each field. If it is 0, the field is required.

jonathanstegall added a commit that referenced this issue Jan 23, 2019
…e if there are any required fields that do not have values. if there are, save the object id as an option and exit out of here. this allows us to wait for meta fields to have values.
jonathanstegall added a commit that referenced this issue Jan 23, 2019
@jonathanstegall jonathanstegall added the fix needs review A fix is in and it needs further testing label Jan 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request fix needs review A fix is in and it needs further testing help wanted Other developer help would be great
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant