[英]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.