简体   繁体   English

限制SOQL查询错误绑定变量仅在Apex代码中允许

[英]Resforce SOQL Query Error Bind variables only allowed in Apex code

I have a controller action that needs to take the Account ID of the logged in user (parent) and make a SOQL query to find all of children associated with the parent. 我有一个控制器操作,该操作需要获取已登录用户(父级)的帐户ID,并进行SOQL查询以查找与父级关联的所有子级。 I receive the following error: 我收到以下错误:

Bind variables only allowed in Apex code

After searching around I've learned that I can't use a variable in my SOQL query. 搜索后,我了解到我无法在SOQL查询中使用变量。 However, I am looking for some help as to pull multiple children on a parent using a dynamic parent ID. 但是,我正在寻找一些帮助,以便使用动态父ID在父上拉多个子。 My query currently looks like this: 我的查询当前如下所示:

@loanparts = client.query("select Loan_Risk__c from Loan_Part__c where Account__c = @account.Account__c")

Change your query to pass accountid as string, I don't know which programming language are you using. 更改查询以将accountid作为字符串传递,我不知道您使用的是哪种编程语言。 Please try this. 请尝试这个。

@loanparts = client.query("select Loan_Risk__c from Loan_Part__c where Account__c ='+AccountId+'") @loanparts = client.query(“从Loan_Part__c中选择Loan_Risk__c,其中Account__c ='+ AccountId +'“)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从Salesforce SOQL查询向变量分配返回值时出现NoMethodError - NoMethodError when assigning returned values to variables from a Salesforce SOQL query Rails 4 ActiveRecord查询:在order子句中绑定变量 - Rails 4 ActiveRecord Query: bind variables in order clause Rails 4 Sendgrid集成出现错误-不允许未经身份验证的发件人 - Rails 4 Sendgrid integration giving error - Unauthenticated senders not allowed KnockoutJS,Rails和分页:数据绑定仅在第一页上应用 - KnockoutJS, Rails and Pagination: data-bind is only applied on the first page 如何添加另一列,该列在视图中应该是只读的,并且可以通过SQL查询(仅从代码中进行显式更改) - How to add another column that should be read-only in the view and can be changed explicitly via SQL query from the code only Rails 4搜索错误数量的绑定变量的单独关键字(1表示2) - Rails 4 search separate keywords with wrong number of bind variables (1 for 2) 将代码推送到Heroku时出错 - Error when pushing code to Heroku Byebug:使用“ info locals / variables”获取当前范围内的变量时出错 - Byebug: Error when using “info locals/variables” for getting variables in current scope Rails4应用程序中实例变量的未定义方法错误 - undefined method error for instance variables in rails4 app 当我尝试编写Rails finder方法时得到“错误数量的绑定变量” - Getting “wrong number of bind variables” when I'm trying to write a Rails finder method
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM