0

I am using databasedotcom gem for interacting with salesforce. I am able to get sObject(Account,Contact,Lead) info. Can any one tell me how to get the user info by passing salesforce session id.

Below code is used to get Account detail from salesforce, but i need to retrieve User info based on session id

client = Databasedotcom::Client.new("config/databasedotcom.yml")
client.authenticate :username => 'xxxxxx', :password => 'xxxxx'
client.sobject_module =SFDC_Models
client.materialize("Account")    
@acc = SFDC_Models::Account.all
4

1 回答 1

0

经过几天的努力,事实证明 :token 参数与会话 ID 相同。对此没有任何记录,但希望它可以在未来帮助其他人。

class HomeController < ApplicationController
        def create
                @session_id = salesforce_params[ :sid ]
                location_split = salesforce_params[ :url ].split("/")
                @location = "http://" + location_split[2]     

                client = Databasedotcom::Client.new                    
                client.authenticate :token => @session_id, :instance_url => @location
                render :text => client.list_sobjects
        end

        private def salesforce_params
                params.permit( :sid, :url )
        end
end
于 2014-09-15T06:36:34.643 回答