zoukankan      html  css  js  c++  java
  • 9.0 sdk 多选选项集

            public string OptionSetVelueC(IOrganizationService serviceAdmin, Entity entity, string str, string _entityName, int[] i = null)
            {
                if (entity.Attributes.Contains(str))
                {
                    string ss = "";
                    OptionSetValueCollection optionSetValues = entity.Attributes[str] as OptionSetValueCollection;
                    var req = new RetrieveEntityRequest
                    {
                        EntityFilters = EntityFilters.Attributes,
                        LogicalName = _entityName,
                        RetrieveAsIfPublished = true
                    };
                    var resp = (RetrieveEntityResponse)serviceAdmin.Execute(req);
                    var attrInfo = resp.EntityMetadata.Attributes.First(a => a.LogicalName == str);
                    var pick = attrInfo as MultiSelectPicklistAttributeMetadata;
                    foreach (var option in pick.OptionSet.Options)
                    {
                        if (null != i)
                        {
                            if (i.Contains(option.Value.Value))
                            {
                                ss += option.Label.UserLocalizedLabel.Label + ",";
                            }
                        }
                        else
                        {
                            if (optionSetValues.Select(x => x.Value).ToList().Contains(option.Value.Value))
                            {
                                ss += option.Label.UserLocalizedLabel.Label + ",";
                            }
                        }
                    }
                    if (!string.IsNullOrEmpty(ss))
                    {
                        ss = ss.Substring(0, ss.Length - 1);
                        return ss;
                    }
                }
                return "";
            }
    

      

  • 相关阅读:
    Vue常用特性-表单基本操作和表单修饰符
    Tab选项卡
    Vue模板语法
    Vue基本使用
    Vue概述
    Express框架
    模板引擎artTemplate
    MongoDB增删改查操作
    数据库概述及环境搭建
    请求响应原理及HTTP协议
  • 原文地址:https://www.cnblogs.com/ly1998/p/12022612.html
Copyright © 2011-2022 走看看