简体   繁体   English

尝试显示与Salesforce帐户相关的所有联系人

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

相关问题 如何使用Restforce gem在ruby on rails中获取与Salesforce客户对象的所有关联数据 - How to get all associated data with the salesforce account object in ruby on rails using restforce gem 尝试使用gem显示来自API的联系人列表,但只能显示几个字段 - Trying to display a list of contacts from an API using a gem but can only get a few fields to show up Ruby on rails 5 根据相关表数量显示所有结果 - Ruby on rails 5 show all results depending on related table quantity 通过我的 Rails 应用程序使用谷歌联系人 api 将联系人添加到我的 gmail 帐户 - adding contacts to my gmail account using google contacts api through my rails app Ruby on Rails:“显示”帐户路线 - Ruby on Rails: 'show' route of account 帐户已删除,将所有帖子从该帐户移至默认管理员帐户 - Account deleted move all posts from that account to default admin account 在rails中重新关联所有相关模型 - Reassociate all related models in rails 仅当用户与当前用户联系时才显示他们的个人资料 - Only show a user's profile if they are contacts with current user 时间戳不会显示在我的联系人数据库中 - Time stamp won't show in my contacts database 删除cloudinary帐户中的所有图像 - delete all images in a cloudinary account
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM