0

I have a rails app connecting to Salesforce through restforce gem. I am trying to map Rails users with Salesforce contact records—so when they log in to my rails app it pulls the record from Salesforce. What will be the best way to do this?

For example, I have devise installed for user authentication.

Scenario 1 - Mapping New Rails User to Existing Salesforce Contact Rails app: John is User1 has an id of "001" and email of "john@salesforce.com" Salesforce: John is an existing Contact1 and has Contact ID of "003C000001lniUd" and email of "john@salesforce.com"

How to map these two, so Rails user John can see only his record from Salesforce Contact? It seems like only way is to connect the dot is through email, but our database might have few Contact records with "john@salesforce.com" in Salesforce.

Scenario 2 - Mapping New Rails User to Create New Salesforce Contact and Mapping the two Rails app: New User2 is created in Rails app with an id of "0001" with an email "mary@salesforce.com"

How to check if there is not duplicate in Salesforce?

I hope this is making sense... Any advice is welcomed. Thanks.

  • 2
    The risk to watch out for here is that a Rails user gets access to existing Salesforce data that belongs to someone else. So the simple and safe approach is that when a new Rails user is created a corresponding new Salesforce Contact is also created (with the two related by adding the Rails id field as a custom field that is not editable by most users to the Salesforce Contact). Otherwise it gets more complicated. Relating identities in two different systems is awkward, but sending email - relying on only the right person being able to access the email - as part of the process is one strategy. – Keith C Nov 22 '14 at 10:41
  • How would you recommend mapping the existing rails users to existing Salesforce contact? – Anthony Gawon Lee Nov 26 '14 at 22:12
  • 1
    You will need a piece of data in common and an email address is a reasonable choice because systems (including Salesforce) rely on only one person having access to emails sent to that an email address. So if you've sent access confirming emails (where the person has to reply) from both the Rails system and from Salesforce, its not too unreasonable to assume that its the same person on both systems. – Keith C Nov 26 '14 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.