码迷,mamicode.com
首页 > 其他好文 > 详细

CRM 2013 批量更新two options的缺省值

时间:2014-09-03 19:36:57      阅读:314      评论:0      收藏:0      [点我收藏+]

标签:style   color   os   io   ar   for   sp   log   on   

  1:  string entNames = "new_print_plan,new_radio_plan,new_bill_board,new_tv_plan,new_btl_posm,new_btl_poe_fixed,new_promotion_girls,new_promotion_events,new_digital_plan";
  2:             string fieldNames = "new_actual_is_cancel,new_is_in_plan";
  3:             foreach (string entityName in entNames.Split(‘,‘))
  4:             {
  5:                 foreach (string fieldName in fieldNames.Split(‘,‘))
  6:                 {
  7: 
  8:                     RetrieveAttributeRequest rar = new RetrieveAttributeRequest()
  9:                     {
 10:                         EntityLogicalName = entityName,
 11:                         LogicalName = fieldName
 12:                     };
 13: 
 14:                     var am = (RetrieveAttributeResponse)service.Execute(rar);
 15:                     if (am.AttributeMetadata.AttributeType == AttributeTypeCode.Boolean)
 16:                     {
 17:                         var bam = am.AttributeMetadata as BooleanAttributeMetadata;
 18:                         bam.DefaultValue = true;
 19: 
 20:                         UpdateAttributeRequest uar = new UpdateAttributeRequest()
 21:                         {
 22:                             EntityName = entityName,
 23:                             Attribute = bam
 24:                         };
 25: 
 26:                         service.Execute(uar);
 27:                     }
 28:                 }

CRM 2013 批量更新two options的缺省值

标签:style   color   os   io   ar   for   sp   log   on   

原文地址:http://www.cnblogs.com/fengwenit/p/3954361.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!