[英]Trying to show all contacts related to salesforce account
I'm using the databasedotcom gem to sync my app with salesforce, it pulls a list of all accounts perfectly, but I need to have a primary contact for each account, I currently have this: 我正在使用databasedotcom gem将我的应用程序与salesforce进行同步,它完美地提取了所有帐户的列表,但是我需要为每个帐户建立主要联系人,目前我有这个联系人:
<p>
<b>License Contact:</b>
<%= Account.contact(@customer.Id).Name %>
</p>
<p>
<b>Email:</b>
<%= Account.contact(@customer.Id).Email %>
</p>
<p>
<b>Phone:</b>
<%= Account.contact(@customer.Id).Phone %>
</p>
and @customer is defined in my controller as @customer = Account.find(params[:id])
和@customer在我的控制器中定义为
@customer = Account.find(params[:id])
Had a look at this link : http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_SOQL_variables.htm 看了一下这个链接: http : //www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_SOQL_variables.htm
Which shows a few parameters and how to call them, I updated my code to this: 其中显示了一些参数以及如何调用它们,我将代码更新为:
@contact = Contact.find_by_AccountID(params[:id])
Then called it in my view: <%= @contact.Name %>
etc. 然后在我看来叫它:
<%= @contact.Name %>
等。
You can create individual objects in your controller and Call them istead. 您可以在控制器中创建单个对象,然后调用它们。 Example
例
@customer_name = Account.find(params[:id]).name
@customer_email = Account.find(params[:id]).email
and in the views you just need to call those objects. 在视图中,您只需要调用这些对象即可。
<p>
<b>License Contact:</b>
<%= @customer_name %>
</p>
Hope this might help's. 希望这会有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.