Closed (won't fix)
Project:
Salesforce Suite
Version:
7.x-3.x-dev
Component:
salesforce_mapping.module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 Aug 2013 at 19:10 UTC
Updated:
21 Feb 2026 at 19:28 UTC
Jump to comment: Most recent
Comments
Comment #1
duit commentedHad any luck with this?
Comment #2
coatezy commentedHas anybody managed to achieve this? This is the only thing that I have struggled to do with the module so far, a testament to the guys developing it!
Comment #3
taits commentedAlso curious if anyone has achieved success with this?
Comment #4
tauno commentedFor pushing, you might be able to use a token. For pulling, you would need to implement hook_salesforce_pull_entity_value_alter() to use a term name from SF and convert that to a term id in Drupal.
A custom field mapping handler could be implemented to make this all possible from the UI. Moving to the Feature Request queue.
Comment #5
mikechristianson commentedI took the first part of tauno's advice and implemented
hook_salesforce_pull_entity_value_alter()to successfully map Salesforce Object fields to Drupal Taxonomy terms. I used the Content Type’s mapped field to obtain the Vocabulary and chose to either create a new term or use the existing one.Please see my post for more detail and the code I used. NB: this solution hijacks the module’s concept of Related Entity; the way I went about it prevents its original, intended usage. I should have used a custom mapping handler and created a proper UI for it.
In the near future I hope to resolve the deficiencies in my implementation and contribute my solution back to this community.
Comment #6
jimafisk commentedI've started creating a module based on mikechristianson's work (thank you Mike): https://www.drupal.org/project/salesforce_term_ref
I wanted to add additional controls to allow users to choose whether or not to add new terms to their taxonomies when incoming terms from Salesforce don't match existing terms. I've done a hook_form_ID_alter() on the salesforce_mapping_form and updated the schema for the salesforce_mapping table to allow saving these settings, which could be different for each salesforce_mapping_id.
I'm having trouble retrieving these settings in order to control whether terms are created or not, which I'm attempting to implement around line 168 of salesforce_term_ref.module - in salesforce_term_ref_create_or_load_term(). I can't seem to get the context for the salesforce_mapping_id outside of the form_alter. To get around this, I was passing this information via a $_SESSION variable, which actually seemed to work when running cron manually through the browser (does not work if you run 'drush cron'). Is there a better way to approach this? Thanks!
Comment #7
mariacha1 commentedIf you want to load the values of a given mapping, you should use:
$mapping = entity_load('salesforce_mapping', $my_mapping_id);
If the value isn't in there, it's possible that it isn't being saved to the database.
Comment #8
jimafisk commentedThank you mariacha1! I think something like entity_load is exactly what I need. The trouble I'm having is getting the salesforce_mapping_id where I'm trying to implement the control. All the logic starts from a hook_salesforce_pull_entity_value_alter() and I can't seem to find the ID for the mapper in $value, $field_map, or $sf_object.
Comment #9
jimafisk commentedI ended up passing the $sf_object variable by reference to hook_salesforce_pull_mapping_object_alter() in order to modify it to include $mapping->salesforce_mapping_id.
Comment #10
damienmckenna@jimafisk: Great work! Thanks for working out the problem with term references. You might want to try uploading the submodule as a patch to the SF module for people to be able to use out of the box.
Comment #11
damienmckenna@jimafisk: Just to mention it, though, the taxonomy term names weren't coming through when I used salesforce_term_ref's "taxonomy term" handler - I use hook_salesforce_push_params_alter() to examine the data being pushed and the terms fields are still empty.
Comment #12
aaronbauman7.x is no longer supported