ROR与Salesforce错误:请求的资源不存在 [英] ROR error with Salesforce: The requested resource does not exist

查看:155
本文介绍了ROR与Salesforce错误:请求的资源不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Ruby Gemdatabascdotcom将Salesforce集成到Rails应用程序中,并且一切正常。

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

但首次调用salesforce时出现错误:

But getting following error on first call to salesforce:

**请求的资源不存在**

如果我再次刷新(Ctrl + F5)页面,它工作正常,没有任何错误。

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   

在第一次调用SalesForceFeed时,它返回错误请求的资源不存在,所以我添加了一个excepton检查并再次调用SalesForceFeed,但我知道这不是正确的方法。

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.

推荐答案

最后我得到了这个问题。物化中添加了错误的对象。我删除了它,它是固定的。

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

这篇关于ROR与Salesforce错误:请求的资源不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆