Hi

I've trying to set up fields mapping using the Salesforce suite. I manage to authorise successfully, getting the following message:

Your Salesforce instance is authorized and has access to the following resources:
sobjects: /services/data/v27.0/sobjects
licensing: /services/data/v27.0/licensing
identity: https://login.salesforce.com/id/{my ID number}
connect: /services/data/v27.0/connect
search: /services/data/v27.0/search
query: /services/data/v27.0/query
tooling: /services/data/v27.0/tooling
chatter: /services/data/v27.0/chatter
recent: /services/data/v27.0/recent
commerce: /services/data/v27.0/commerce

But when I go to create a field mapping, I select the Drupal Entity and Entity Bundle (User), but the Salesforce Object is empty, and so I can't select 'contacts'. I've checked the error logs, and can see some errors like:

Undefined index: salesforce_record_type_default in salesforce_mapping_form_validate() (line 520
Warning: in_array() expects parameter 2 to be array, null given in salesforce_mapping_form_validate() (line 520...

I'm using the Professional Edition of Salesforce with the API being a paid for add, rather than the Enterprise Edition where it comes out of the box. I don't know if this is part of the problem?

Thanks in advance for any help.

Comments

DerekL’s picture

Version: 7.x-3.0 » 7.x-3.x-dev

I am running on a fresh D7.34 install and I can confirm this issue on both 7.x-3.x-dev and 7.x-3.0
Config->Salesforce->authorize shows all resources, but admin/structure/salesforce/mappings/add shows an empty Salesforce object select box.

Log shows:
Notice: Undefined index: salesforce_record_types_allowed in salesforce_mapping_form_validate() (line 519 of /var/www/html/sites/all/modules/salesforce/modules/salesforce_mapping/includes/salesforce_mapping.admin.inc).

Notice: Undefined index: salesforce_record_type_default in salesforce_mapping_form_validate() (line 519 of /var/www/html/sites/all/modules/salesforce/modules/salesforce_mapping/includes/salesforce_mapping.admin.inc).

Warning: in_array() expects parameter 2 to be array, null given in salesforce_mapping_form_validate() (line 519 of /var/www/html/sites/all/modules/salesforce/modules/salesforce_mapping/includes/salesforce_mapping.admin.inc).

infoox’s picture

Does anybody know what is causing this error? Any advice would be appreciated.

DerekL’s picture

Ok. I have done zero testing on this, but it did get this module working for my purposes.

I nearly moved on and forgot completely about this, but Infoox did us all the favor of having me come back and share.

My client upgraded salesforce Pro with the API service as an add-on. This is the only thing I could identify that would possibly cause a difference in query results, between this and vanilla enterprise API access.

Anyway, I traced the issue to the fact that the admin query to salesforce had a 'triggerable=>true' filter on it, causing the query to come up empty, causing the admin to think things were not working.

All I did to get this working was comment out line 973 of salesforce_mapping.admin.inc.
IE:

else {
$sfapi = salesforce_get_api();
// Note that we're filtering SF object types to a reasonable subset.
$sfobjects = $sfapi->objects(array(
'updateable' => TRUE,
//'triggerable' => TRUE,
));
$form_state['sfm_storage']['salesforce_object_type'] = $sfobjects;
}

I know this issue is out there, alive in some blog comments section as well. Hopefully this will save folks some sweat.

Cheers,
-d

infoox’s picture

Thanks DerekL. This worked for me.

I'd suggest this change is added to the next release of the module, as there will be other people using Professional Editions with the API add on.

Cheers

tauno’s picture

Status: Active » Closed (duplicate)