0

I am using the Ruby Gem "databascdotcom" to integrate Salesforce in a Rails app and all works fine.

But getting following error on first call to salesforce:

**The requested resource does not exist**

If I refresh (Ctrl + F5) the page again, it works fine without any error.

Here is my code:

def SalesForceFeed
  @oppID = params[:oppid]

  client = Databasedotcom::Client.new client.client_id #=> foo client.client_secret #=> bar
  client.authenticate :username => "foo@bar.com", :password => "ThePasswordTheSecurityToken" #=> "the-oauth-token"
  client.materialize("Opportunity")
  begin
      @client=SalesForce::Connection.new.client
      @opp = Opportunity.find_by_Id(@oppID)
  rescue Exception=>e
    if(e.message == "The requested resource does not exist")
      return redirect_to :action => 'SalesForceFeed', :oppid => @oppID
    end
  end   

On the first call to "SalesForceFeed" it returned the error "The requested resource does not exist", so I added an excepton check and called "SalesForceFeed" again, but I know this is not the right way.

Please suggest me a better way to fix this. Thanks.

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
Anil D
  • 1,989
  • 6
  • 29
  • 60
  • finally i got the issue, there was a wrong object added in materialize, i removed that and its fixed – Anil D Jul 26 '12 at 13:47

1 Answers1

0

Finally i got the issue. There was a wrong object added in materialize. I removed that and it's fixed.

Peter DeWeese
  • 18,141
  • 8
  • 79
  • 101
Anil D
  • 1,989
  • 6
  • 29
  • 60