CRM 2013动态OptionSet问题 [英] CRM 2013 Dynamic OptionSet issue

查看:146
本文介绍了CRM 2013动态OptionSet问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在内部使用CRM 2013,并且其中包含一个属性,该属性具有一个选项集(非全局),其文本和值为虚拟条目 0。未分配默认值。



我的代码是在此选项集中添加具有某些业务逻辑的选项。因此,我可以通过Javascript在其中添加新选项。



当我通过Javascript在其中添加选项时,不允许我更改值,比如说



添加了Option1 val1
Option2 val1,然后它就不允许我选择这些值,并且每次选择它们都将恢复为默认条目-,并且没有任何变化。



但是可以说我添加了
Option1 0
Option2 0



作为文本和值,它们会很好地显示,选择其中的任何一个都会将文本更改为虚拟条目。



基本上,如果选项列表中存在该值(它们是静态的,不是通过JS添加的),它就接受并选择它并从中显示文本。 / p>

如果在静态选项列表中未找到该值,则不选择任何内容并显示默认的-



我希望我很清楚,如有任何混淆,请告诉我。以下代码段在CRM 2011中有效,而在CRM 2013中无效。

  //测试功能
populateBundleLists:function(){
var bundleListControl = Xrm.Page.getControl( XXX_bundlelist);
var bundleOptions = bundleListControl.getAttribute()。getOptions();
var bundleOption = bundleOptions [0];
bundleListControl.clearOptions();

//添加一些任意值以控制
,以便(var i = 1; i< = 7; i ++){
bundleOption.value = i;
bundleOption.text ='虚拟捆绑包'+ i.toString();
bundleListControl.addOption(bundleOption,i-1);

}
},


解决方案

CRM将OptionSet存储在实体配置中,并且需要了解所有可能值的全部。您无法使用JS b / c添加新选项,当有人使用其他机制(获取XML,高级查找,过滤视图等)进行查询时,系统将无法解析您的 new 值。


I am using CRM 2013 On premise, and in it there is an attribute which has an option set (not global) having text and value as "Dummy Entry" "0". Default Value is unassigned.

My code is to add options in this option set with some business logic. So I can add new options in it via Javascript.

When I am adding Options in it via Javascript, it is not allowing me to change the value lets say

Option1 val1 Option2 val1 is added then it wont allow me to select these values and every-time selecting them will revert to default entry "--" and nothing will change.

But lets say I add "Option1" "0" "Option2" "0"

as text and values, they are shown finely and selecting any of them changes the text to "Dummy Entry".

Basically somehow if the value exists in the list of Options (which are static and not added via JS), it is accepting and selecting it and showing text from it.

If the value is not found in the static option list, it doesnt select anything and show default "--"

I hope I am clear, please let me know in case of any confusion. The following snippet is working in CRM 2011 while not working in CRM 2013.

// testing function
populateBundleLists: function () {
    var bundleListControl = Xrm.Page.getControl("XXX_bundlelist");
    var bundleOptions = bundleListControl.getAttribute().getOptions();
    var bundleOption = bundleOptions[0];
    bundleListControl.clearOptions();

    // add some arbitrary values to control
    for (var i = 1; i <= 7; i++) {
        bundleOption.value = i;
        bundleOption.text = 'Dummy bundle ' + i.toString();
        bundleListControl.addOption(bundleOption, i - 1);  

    }
},

解决方案

CRM stores OptionSets in the entity configuration and will need to know about all of the possible values. You cannot add new options using JS b/c the system will not be able to resolve your new value when someone queries using a different mechanism (Fetch XML, Advanced Find, filtered view, etc).

这篇关于CRM 2013动态OptionSet问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆