使用 apex 在 salesforce 中创建多选查找
我想创建一个多选联系人查找。
我想要什么:
当用户单击查找时,他应该能够从中选择多个联系人。
我所做的:
我使用
“查找”和
“MasterDetail关系”和
“<强>连接对象”
当我尝试将此字段用于任何输入文本/字段时,它总是提供一个选项来从查找中仅选择一个值,但我希望有一个选项来选择多个值。
即使在 Junction 对象中,我创建了 2 个主从关系,查找仍然只允许选择一个值。此外,它使该字段成为我不想要的强制字段。
我关注的链接: http://success.salesforce.com/questionDetail?qId=a1X30000000Hl5dEAC
任何人都可以建议吗我该怎么做。
这与我们在任何潜在客户的发送电子邮件选项下使用电子邮件抄送/密件抄送相同。
I want to create a multi-select Contact Lookup.
What i want :
When user clicks on a lookup then he should be able to select multiple contacts from that.
What i have done:
I have created an object and a field inside that object using both
"Lookup" and
"MasterDetail Relationship" and
"Junction Object"
When i try to use this Field for any input text/Field then it always provides an option to select only one value from lookup but i want to have an option to select multiple.
Even in the Junction object i have created 2 master-detail relationships still lookup allows only one value to be selected.Moreover it makes the field mandatory which i don't want.
Links that i followed:
http://success.salesforce.com/questionDetail?qId=a1X30000000Hl5dEAC
Can anybody suggest me how to do this.
Its same as we use Email CC/BCC under Send Email option for any Lead.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
即使您使用连接对象,查找也只是引用(查找)另一条记录:当您在连接对象上创建一条记录时,您仍然必须单独设置每个查找,并且仍然只创建一条记录。
主细节关系本质上是类固醇的查找,一个对象成为另一个对象的子对象,并且如果父对象被删除,则该对象将被删除,它们不会提供一个接口来一次查找许多记录。
如果您不是开发人员,那么最好的选择是一次只创建联结对象记录,或者考虑使用数据加载器。您可以在 Excel 或类似文件中准备数据,然后一次性将所有记录上传到 Salesforce。
如果您是开发人员,或者有开发人员可供您使用,那么我们过去所做的就是创建一个 Visualforce 页面来完成这项工作。因此,例如,如果您想将一堆联系人链接到一个帐户,我们会在页面上有一个帐户查找字段,然后是一些与联系人字段相关的搜索字段。然后,您可以使用 SOQL 查询找到与搜索参数匹配的所有联系人,并将它们显示在列表中,您可能需要在列表中提供复选框以允许用户选择他们想要的联系人。然后,只需循环选定的联系人,将其帐户字段设置为所选帐户即可。
Salesforce 中的某些区域(例如您提到的发送电子邮件功能)可以清楚地看到已经完成了定制工作来完成特定任务 - 您想要的另一个例子是您可以管理营销活动成员的区域。这是我过去在实现所描述的 Visualforce 页面时复制的模型。
祝你好运!
Even you use a junction object a lookup is just that, it references (looks up to) one other record: when you create a record on the junction object you still have to set each lookup individually and you're still creating only one record.
Master Detail relationships are essentially lookups on steroids, one object becomes the child of the other and will be deleted if the parent object is deleted, they're not going to provide an interface to lookup to many records at once.
If you're not a developer then your best bet is to either just create on junction object record at a time, or look into using dataloader. You could prepare your data in Excel or similar and then upload all the records into Salesforce in one go.
If you are a developer, or have developers at your disposal, then what we've done in the past is create a Visualforce page to do the job. So if, for example, you wanted to link a bunch of contacts up to an Account, we'd have a single account lookup field on the page, then some search fields relating to fields on the contact. Using a SOQL query you can then find all contacts matching the search parameters and display them in a list, where you may want to provide checkboxes to allow the user to select the contacts they want. Then it's just a case of looping through the selected contacts, setting their Account field to be the chosen account.
There are areas in Salesforce (such as the send Email functionality you mentioned) where it's clear to see that bespoke work has been done to fulfil a specific task — another instance of what you want is in the area where you can manage campaign members. This is the model I've copied in the past when implementing a Visualforce page as described.
Good luck!
为了一次添加多个连接对象,我们找到的唯一解决方案是自定义 Visualforce 页面,如 LaceySnr 所描述。
对于稍微不同的问题,我们需要将对象 B 的许多内容分配给对象 A,我们已经训练用户通过对象 B 的视图来执行此操作。我们将计费帐户 (B) 分配给支付办公室 (A)。计费帐户视图的左侧有复选框。用户检查要分配的计费帐户,然后双击任何检查行上的“付款办公室”字段。弹出窗口询问您是否只想更新单行或所有选中的行。通过选择“所有选中的行”,将对所有行进行更新。
该视图由用户创建,用户输入选择标准(名称、地址、州等)。所有用户创建的视图仅对其可见。
For adding multiple junction objects at one time, the only solution we have found is a custom Visualforce page, as described by LaceySnr.
For a slightly different problem, where we need to assign many of object B to object A, We have trained our users to do this with a view on object B. We are assigning Billing Accounts (B) to Payment Offices (A). The view on Billing Account has check boxes on the left side. The user checks the Billing Accounts to be assigned, then double-clicks on the Payment Office field on any of the checked rows. A pop-up asks if you want to update only the single row or all checked rows. By selecting 'all checked rows', the update is done to all of them.
The view is created by the user, who enters the selection criteria (name, address, state, etc.). All user-created views are visible only to them.