I've been doing some work setting up a site that pulls data from salesforce and I have found it difficult to determine the originating mapping for individual mapping objects. My solution for this was to just add another column to the mapping object table with the mapping id.

I think this relationship should live in the database and it will only be beneficial in the future as 7.x-3.x continues to develop... here's a patch of my changes in case you agree with me.

Comments

kostajh’s picture

Status: Active » Needs review
kostajh’s picture

Version: 7.x-3.0-alpha2 » 7.x-3.x-dev
levelos’s picture

@ceardach, can you clarify some use cases where this is needed? Thanks.

levelos’s picture

Status: Needs review » Needs work
mariacha1’s picture

Issue summary: View changes
Status: Needs work » Closed (won't fix)

I'm going to say there wasn't enough interest in this as a feature to continue to consider it.

jimafisk’s picture

I think this is exactly what I need for: https://www.drupal.org/node/2061623#comment-11821386

The issue for me is I'm setting a value at the level of the salesforce_mapping, but have no way to retrieve that value when implementing the control for objects created by that mapping.

jimafisk’s picture

To follow up here, I tested markisatacomputer's patch and it works as intended: it adds a column to the salesforce_mapping_object table called salesforce_mapping_id and populates the correct mapping_id without error. I applied this to 7.x-3.2 so I needed to re-roll the patch which I've included here in case it's helpful to someone.

This didn't help my particular use case because I was trying to query the salesforce_mapping_object table using $sf_object['Id'] to get the new salesforce_mapping_id value (in order to use it in another query on the salesforce_mapping table, where I was storing some admin settings). However, I was trying to query the record before it was actually saved, which of course can't work. Ultimately I ended up using hook_salesforce_pull_mapping_object_alter() to modify $sf_object to include the mapping_id.