Salesforce.com 两个对象之间的视觉力
在 salesforce 中,我需要创建一个包含 2 个对象字段的 Visualforce 页面。第一个对象是 QUOTE 对象。第二个对象是具有多个字段的自定义对象。
- 我想创建一个 Visualforce 页面,显示 QUOTE 和新对象的记录。我可以在不创建自定义控制器的情况下执行此操作吗?如果没有关于这个新控制器的代码的任何提示?
- 我可以在 Visualforce 页面中的字段之间进行计算吗?
- 理想情况下,我希望在“QUOTE”设置为“ACCEPTED”后立即显示此页面
In salesforce I need to create a visualforce page that includes the fields of 2 objects. The first object is the QUOTE object. The second objects is a custom object with several fields.
- I want to create a visualforce page that shows the records of both QUOTE and the new object. Can I do this without creating a custom controller? If no any hints on the code for this new controller?
- Can I do calculations between fields in a visualforce page?
- Ideally I want this page to appear as soon as the QUOTE is set to ACCEPTED
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
1:不幸的是,如果没有自定义控制器,您就无法执行此操作,除非一个对象与另一个对象相关,并且您很乐意将其显示为父对象页面上的相关列表。对于计算,您可以使用汇总摘要来进行一些基本求和等。对于
自定义控制器,请查看字段集,以获取将字段放入 VF 页面的超级简单方法,您本质上是在对象上配置字段组,然后您可以用最少的标记将这些组粘贴到页面上。
2:对于具有复杂计算的字段,您需要在控制器中进行求和,然后以通常的方式通过变量将结果公开到页面上。
3:如果不首先创建自定义编辑页面,实际上是不可能的 - 最好在报价页面上有一个按钮来打开 Visualforce 页面,如果报价不正确,该页面只会显示错误却被接受了。不过,还有一些其他替代方案可能有效,例如当状态符合您的要求时,使用 forumla 字段生成页面链接。
我很乐意详细说明其中的任何一个,但您询问第二点的事实表明您没有太多在该平台上开发的经验(不是挖掘,只是观察),所以除非如果您习惯在其他环境中进行编码,您可能会发现这非常棘手。也就是说,您在 stackoverflow,所以我认为您可能至少对编码有所了解!
1: You can't do this without a custom controller unfortunately, unless one object is related to the other and you're just happy displaying it as a related list on the parent object's page. For calculations you could use rollup summaries for some basic sums etc..
As for a custom controller, have a look at field sets for a super easy way to get fields into a VF page, you essentially configure groups of fields on your objects and then you can stick those groups onto a page with minimal markup.
2: For fields with complex calculations you'll want to do the sums in the controller and then expose the results through variables onto the page in the usual manner.
3: Not really possible without creating a custom edit page in the first place — you'd be better off having a button on the quote page to open up the Visualforce page, that page can simply display an error if the quote is not yet accepted. There are some other alternatives that might work though, like using a forumla field to generate a link to the page when the status is as you desire.
I'm happy to elaborate on any of this, but the fact that you're asking about number 2 would suggest to me that you don't have much experience developing on the platform (not a dig, just an observation), so unless you're comfortable coding in other environments you could find this quite tricky. That said, you're on stackoverflow so I'm thinking you probably know a little about coding at least!