将 MS CRM 国家和州字段转换为下拉列表

发布于 2024-12-12 07:31:28 字数 150 浏览 3 评论 0原文

默认情况下,Microsoft Dynamics CRM 2011 中的国家/地区和州/省字段是纯文本框。

我希望它们成为下拉菜单,并根据国家/地区下拉列表中的选择更新州下拉列表。但是,我不想为世界上每个国家/地区提供州和省份,因此任何未配置的都应该只显示正常的文本框。

By default, country and state/province fields in Microsoft Dynamics CRM 2011 are plain textboxes.

I want them to be dropdowns instead, with the state dropdown being updated based on the selection in the country dropdown. However, I don’t want to have to come up with states and provinces for every country in the world so any unconfigured ones should just show the normal text box.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甲如呢乙后呢 2024-12-19 07:31:28

在尝试了许多不同的解决方案后,我们没有找到任何可以按照我们想要的方式工作的解决方案,因此我们创建了一个新的解决方案。

我们创建了一个 countries_and_states.js 脚本,该脚本会将 Country 字段转换为也驱动州/省字段的下拉菜单。州/省字段将是已配置国家/地区的下拉列表(默认情况下仅美国和加拿大,但很容易添加您自己的国家/地区)。如果尚未配置国家/地区,则州/省字段将回退到默认文本框。

有关如何使用它的更多信息,请访问 此博文

After trudging through many various solutions we didn't find anything that worked the way we wanted so we created a new solution.

We created a countries_and_states.js script that will turn the Country field into a dropdown that drives the State/Province field as well. The State/Province field will be a dropdown for countries that have been configured (by default only USA and Canada, but it’s easy to add your own). If a country has not been configured, the State/Province field falls back to the default textbox.

More info on how to use it can be found on on this blog post.

挽梦忆笙歌 2024-12-19 07:31:28

拥有动态控件的唯一“认可”方法(我认为组合框描述了您想要实现的目标)是使用 Silverlight/HTML Web 资源,它可以通过 JavaScript 与表单数据进行交互。

我们一直在使用与您类似的方法来创建多选选择列表(将文本字段转换为复选框列表,然后将结果存储为 CSV),但是我们遇到了一个您可能需要注意的问题的。

为了让 ISV 通过 MS CRM Marketplace 提供其产品,产品需要通过 ISV 软件测试(.doc 可在此处)。此测试不允许更改 DOM:

直接修改CRM UI的文档对象模型(DOM)
组件可能会破坏应用程序的稳定性和/或完全破坏它。

如何遵守

• 不要直接访问或修改文档对象模型 (DOM)
任何 CRM UI 组件/控件。

因此,我们发现我们必须重新审视我们的代码,以取代 JavaScript DOM 摆弄,转而使用更重量级但最终得到更多支持的 Silverlight 控件。

如果您无意使用该市场,那么这不会对您产生影响,只是要注意您的修改可能在未来的 CRM 更新中不受支持。

The only 'approved' way of having a dynamic control (I think a combo-box describes what you're attempting to achieve) would be to use a Silverlight/HTML Web Resource which could interact with form data through JavaScript.

We've been using a method similar to yours for creating multi-select pick lists (turning text fields into a list of check boxes then storing the result as CSV), however we've come into a problem which you might want to be aware of.

In order for an ISV to have their product available through the MS CRM Marketplace, the product needs to pass an ISV Software Test (.doc available here). Alteration of the DOM is not permitted by this test:

Directly modifying the Document Object Model (DOM) of CRM UI
components can destabilize the application and/or completely break it.

How to Comply

• Do not directly access or modify the Document Object Model (DOM)
of any CRM UI component/control.

So we've found we've had to revisit our code to swap out JavaScript DOM fiddling in favour of more heavy-weight, but ultimately more supported, Silverlight controls.

If you've no intention of utilising the marketplace then this doesn't need to effect you, other than to be aware your modifications may not be supported in future updates to CRM.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文