Can’t Authorize
-
Hi,
Trying to install in sandbox.
Under the Authorize tab, once I hit “Connect to Salesforce”, it goes to
And then back to
https://MY_SITE.com/wp-admin/options-general.php?page=object-sync-salesforce-admin&tab=authorize
And won’t authorize.
I tried both adding the values in WP, and in wp-config.php as well with no luck.
I enabled debug and logging, but couldn’t find the log file. Where is it located?
Thanks!
-
@shayatik when the browser sends you back to the authorize link, does it just keep showing you the Connect to Salesforce button, or does it show another message? Does it do anything different if you refresh the page at that time (the plugin is supposed to automatically refresh, and then show you its correct status)?
As for the logging, the plugin stores logs as their own content type. You can see a bit more about this, and I just added a screenshot to show how the content type appears in the admin, here: https://github.com/MinnPost/object-sync-for-salesforce/blob/master/docs/logging.md
It does refresh the page, but it keeps showing me the “Connect to Salesforce” button.
My “logs” section is empty.
In Salesforce, however, I do see 1 user using the app: https://imgur.com/8zlQnWu
@shayatik do you have any errors in your PHP logs? It’s possible something is happening there. But also, what permissions does the app have in Salesforce?
In general they should look like this image. If they don’t, it’s possible that is the reason. But if the permissions match, perhaps it is a server issue.
I gave it full access for now.
Gonna check out the PHP error logs.
OK, PHP error log right after hitting “Connect To Salesforce”:
[16-Nov-2017 18:52:57 UTC] WordPress database error Table 'i4139082_wp1.wp_object_sync_sf_field_map' doesn't exist for query SELECT
id,
label,
wordpress_object,
salesforce_object,
salesforce_record_types_allowed,
salesforce_record_type_default,
fields,
pull_trigger_field,
sync_triggers,
push_async,
push_drafts,
weight` FROM wp_object_sync_sf_field_map made by require_once(‘wp-admin/admin.php’), do_action(‘settings_page_object-sync-salesforce-admin’), WP_Hook->do_action, WP_Hook->apply_filters, Object_Sync_Sf_Admin->show_admin_page, Object_Sync_Sf_Mapping->get_fieldmaps[16-Nov-2017 18:53:02 UTC] WordPress database error Table ‘i4139082_wp1.wp_object_sync_sf_field_map’ doesn’t exist for query SELECT
id
,label
,wordpress_object
,salesforce_object
,salesforce_record_types_allowed
,salesforce_record_type_default
,fields
,pull_trigger_field
,sync_triggers
,push_async
,push_drafts
,weight
FROM wp_object_sync_sf_field_map made by require_once(‘wp-admin/admin.php’), do_action(‘settings_page_object-sync-salesforce-admin’), WP_Hook->do_action, WP_Hook->apply_filters, Object_Sync_Sf_Admin->show_admin_page, Object_Sync_Sf_Mapping->get_fieldmaps[16-Nov-2017 18:53:03 UTC] WordPress database error Table ‘i4139082_wp1.wp_object_sync_sf_field_map’ doesn’t exist for query SELECT
id
,label
,wordpress_object
,salesforce_object
,salesforce_record_types_allowed
,salesforce_record_type_default
,fields
,pull_trigger_field
,sync_triggers
,push_async
,push_drafts
,weight
FROM wp_object_sync_sf_field_map made by require_once(‘wp-admin/admin.php’), do_action(‘settings_page_object-sync-salesforce-admin’), WP_Hook->do_action, WP_Hook->apply_filters, Object_Sync_Sf_Admin->show_admin_page, Object_Sync_Sf_Mapping->get_fieldmaps`@shayatik It seems like the plugin has been unable to create the required database tables. Without those tables, it won’t work. You could try deactivating/reactivating the plugin. It will try again to create the tables. But if your PHP user doesn’t have permission to create database tables, for example, it won’t work.
The user has all privileges: https://imgur.com/a/KkCnK
I tried deactivating / reactivating it. No Luck.
I’m hosted on GoDaddy.
Seems like my only option is to manually create those tables in the DB, which I’m not excited about :/
@shayatik that is the MySQL user; it is possible that Godaddy doesn’t allow the Apache user to create tables. I’m not super familiar with Godaddy, but I know they do lock down some things that other hosts might allow.
A quick Google search found this:
A DO_NOT_UPGRADE_GLOBAL_TABLES define prevents dbDelta() and the upgrade functions from doing expensive queries against global tables.
So if you have a
DO_NOT_UPGRADE_GLOBAL_TABLES
value in your wp-config.php file, the plugin will be blocked from installing the tables, even if the PHP user would otherwise be allowed to do so.But in any case these are not very hard tables to create. You could try two different things, I think.
1. Try creating the tables without deactivating the plugin. This might not work though, just because the plugin might have failed to do the other things it requires.
2. Deactivate the plugin first, then create the tables, then reactivate the plugin. I think this is probably safest, since the plugin will ignore the table methods if the tables already exist.Either way, here’s SQL you could use to create the tables:
table one
CREATE TABLE wp_object_sync_sf_field_map ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, label varchar(64) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '', name varchar(64) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '', wordpress_object varchar(128) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '', salesforce_object varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '', salesforce_record_types_allowed longblob, salesforce_record_type_default varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '', fields text COLLATE utf8mb4_unicode_520_ci NOT NULL, pull_trigger_field varchar(128) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT 'LastModifiedDate', sync_triggers text COLLATE utf8mb4_unicode_520_ci NOT NULL, push_async tinyint(1) NOT NULL DEFAULT '0', push_drafts tinyint(1) NOT NULL DEFAULT '0', weight tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (id), UNIQUE KEY name (name), KEY name_sf_type_wordpress_type (wordpress_object,salesforce_object) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
table two
CREATE TABLE wp_object_sync_sf_object_map ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, wordpress_id varchar(32) COLLATE utf8mb4_unicode_520_ci NOT NULL, salesforce_id varchar(32) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '', wordpress_object varchar(128) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '', created datetime NOT NULL DEFAULT '0000-00-00 00:00:00', object_updated datetime NOT NULL DEFAULT '0000-00-00 00:00:00', last_sync datetime NOT NULL DEFAULT '0000-00-00 00:00:00', last_sync_action varchar(128) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL, last_sync_status tinyint(1) NOT NULL DEFAULT '0', last_sync_message varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL, PRIMARY KEY (id), UNIQUE KEY salesforce (salesforce_id), UNIQUE KEY salesforce_wordpress (wordpress_object,wordpress_id), KEY wordpress_object (wordpress_object,wordpress_id), KEY salesforce_object (salesforce_id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
-
This reply was modified 7 years, 4 months ago by
Jonathan Stegall. Reason: try to fix the code formatting
-
This reply was modified 7 years, 4 months ago by
Jonathan Stegall.
I think I’m gonna go in a different direction.
Instead of GoDaddy’s WordPress auto install, I’ll start from scratch. I’ll create a new DB, extract WordPress files on the server and see if it works. I’ll keep u posted.
Thanks!
So I installed everything from scratch. Didn’t work.
I created the tables manually in the DB using your SQL. No luck.
-
This reply was modified 7 years, 4 months ago by
shayatik.
@shayatik if you deactivate the plugin, then create the tables manually, then reactivate the plugin, I think it’s possible it will work. If this does not work, I would be inclined to talk to Godaddy’s support. We certainly can’t provide that here.
Ok, so it didn’t work with sandbox.
I tried connecting it to my production instance with no issue. I guess it has something to do with the sandbox instance.
A quick question. Does it support Advanced Custom Fields? Let’s say I want to import all of my contacts in SF into WP as users.
In WordPress I’ve used Advanced Custom Fields to add fields to the user record. For example – in WordPress’ user record I have a field called “Father Name”. I have this field in Salesforce as well. Will I be able to map them?
Thanks!
@shayatik I am not super familiar with ACF, but I think it will work. As long as ACF uses standard ways of storing the fields in the database (basically wp_usermeta, wp_postmeta, wp_termmeta), it should work. This plugin intentionally supports the core methods for adding fields. Many plugins don’t use that, but I think ACF does.
We also have a ton of developer hooks in this plugin for extending to work with other methods of doing fields. There’s some documentation about this.
There is one issue you may run into if ACF does use the core methods: if there aren’t records that have a value for a given field, the plugin won’t realize that it exists. So you have to have at least one record with a value for the field to map that field to Salesforce.
Ok, just tested it. The field won’t show up in the list: https://imgur.com/a/OaVKL
Thanks anyway.
You can try a few things: 1) make absolutely sure the field is already in use with values. 2) clear the cache on the fieldmap list page. This is super important. 3) realize that the field list is not alphabetical. Often, custom fields start with an underscore.
If none of those things work, you’ll need to use the developer hooks to build on top of this plugin.
-
This reply was modified 7 years, 4 months ago by
- The topic ‘Can’t Authorize’ is closed to new replies.