Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7089679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:57:06+00:00 2026-05-28T07:57:06+00:00

I am developing a Rails app using OmniAuth, OmniAuth-salesforce and this gem: https://github.com/heroku/databasedotcom I

  • 0

I am developing a Rails app using OmniAuth, OmniAuth-salesforce and this gem: https://github.com/heroku/databasedotcom

I am hardcoding the “client_id” and “client_secret” into my app. Then for each user that authenticates with Saleforce, I am capturing their oauth token, user id, and instance url. With all this, I am creating leads on their behalf.

Everything works if the user is from the same account where I got the “client_id” and “client_secret”. However, if I authenticate with a user from another Salesforce instance, I get an “invalid cross reference id” error.

I want my app to be submitting leads for users from many different Salesforce intances. Is this not possible?

Here is my full code:

client = Databasedotcom::Client.new :client_id => SALESFORCE_CLIENT_ID, :client_secret => SALESFORCE_CLIENT_SECRET
client.authenticate :token => user.salesforce_token, :instance_url => user.salesforce_instance_url
client.materialize("Lead")

lead = Lead.new(:FirstName => first_name, :LastName => last_name, :Email => email, 
                :Phone => phone, :OwnerId => user.salesforce_id, :IsConverted => false,
                :IsUnreadByOwner => true, :Company => contact_company)
lead.save

Thanks for any advice!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:57:06+00:00Added an answer on May 28, 2026 at 7:57 am

    The error will be coming from the user.salesforce_id reference you’re setting for ownerId, and leads me to think that you are somehow mixing the data up, i.e. you’re sending user1 but to the user2’s session. I haven’t used the gem you mention, but from the code, i can’t see how the lead instance is associated with the particular client instance. How does lead.save know to use the client instance you just created ?

    Looking more at how materialize(“Lead”) works, it seems like the Lead.new is always going to create a lead that associated with the first client instance you created, so you’d be trying to send all the leads the first user that you authenticate.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Rails 3 app I'm developing with a team using Git/Github and
I am developing a Rails 3 app using the Devise gem for authentication. I'm
I am developing a web app (using rails) that I will be launching within
I'm using the RESTful authentication Rails plugin for an app I'm developing. I'm having
I have started developing a new Rails app on my server using RVM, Rails
I'm developing a rails 3.0.9 app, I'm using accept nested attributes for to add
I am using MySQL v5.1. I am developing a Rails app. and writing a
I'm currently developing a Rails app with 4 nested models (as per THIS POST
i am developing a app and have been for a while using Rails 2.3.4
I'm developing a Rails 3 app using Devise and CanCan. The app allows anonymous

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.