I think this might depend on what plugin you’re using to store the event in WordPress, or it might be a limitation of how the plugin tries to tell WordPress about datetime values in Salesforce.
Here’s how it currently works when it pulls data from Salesforce:
1. It looks to see if the Salesforce field is a date or datetime field.
2. If it is, it gets the date format from the WordPress settings (which is UTC if it’s not otherwise specified) and assumes that as the format.
3. It checks to see if the WordPress field is already specified as a datetime field, or if the WordPress object type is tribe_events (for The Events Calendar). If either of those is true, it sets the format to instead use Y-m-d H:i:s.
4. It runs date_i18n on the value with whatever format it has determined that it should use.
After this sequence is done, it assumes that whatever has been returned by date_i18n can be saved into the WordPress field (see these lines of code if that’s of interest to you).
I think it’s possible/likely that this doesn’t work for all possible situations where a datetime field needs to be saved. If that’s the case for you, I think there are a few options:
1. If there’s a bug in what is already happening and it can be reproduced and a fix can be identified that doesn’t break what is currently working, I’d be happy to add it.
2. If there are other plugins that use some different pattern and they can easily be isolated in a way that doesn’t affect what’s currently there, I’d be willing to add that as well. This plugin doesn’t pretend to support all possible ways of storing data in WordPress, but I’m not opposed to adding things for specific plugins if they can be self-contained.
3. There is a filter, see object_sync_for_salesforce_pull_params_modify for some documentation, that you could use in your theme or in an add-on plugin to directly influence what is happening with the parameters. This might be faster if you have the resources to do that. I don’t really support the filters here, but would like to see what is happening in case it does belong in the plugin.
I’m not entirely sure what you mean by the second question. You certainly can get the name of a contact via the plugin, but what are you looking to do with it?
Thank you for the response, I’ll have a play around now that I know the above.
The events are just a custom post type, we’ve decided against a calendar for this build in particular, so there’s no plugins in play as such when storing the events
Initially I was using an ACF Datetime field to try and store this – although upon reading on the plugins overview page that ACF isn’t supported directly, I have tried this with a WordPress custom field instead. However the result is the same
As a real example just to explain better I’ve set up an event in Salesforce on the 14th June from 11am till 12-30pm and the times haven’t pulled through at all – the logs show “2022-06-14T11:00:00.000+0000” and “2022-06-14T12:30:00.000+0000” which are seemingly correct.
But then the WordPress custom field just states “14 June 2022” and the ACF DateTime one says “2022-06-14 00:00:00” so they both seem to be having the same issue.
I’ll keep trying!
-
This reply was modified 3 years, 11 months ago by
tylersands12.
-
This reply was modified 3 years, 11 months ago by
tylersands12.
-
This reply was modified 3 years, 11 months ago by
tylersands12.