zoukankan      html  css  js  c++  java
  • Dynamics CRM

          Contact 是 CRM 默认带有的 Entity,主键是 <FullName>,根据开发需求,与主键相关的字段都被设置成隐藏,包括了<Full Name>,<First Name>,<Last Name>, 其中 <Full Name> = <First Name> + <Last Name>。这时我们需要通过 C# plugin 给主键赋值。

          一开始,我想在 plugin 里直接给<FullName>字段赋值,代码如下:

    entity.FullName = "test";

          结果行不通,代码编译不通过,因为FullName是只读的。

          那么,我们就换另外一种方式:

    entity["fullname"] = "test";

          代码编译通过了,但是执行的时候可能会报错,因为<Last Name>可能是要求必填的。

         

          根据需求修改一下代码,给必填项也赋值就可以了:

    entity["firstname"] = string.Empty;
    entity["lastname"] = "test";
    entity["fullname"] = "test";
  • 相关阅读:
    HDU 3081 Marriage Match II
    HDU 4292 Food
    HDU 4322 Candy
    HDU 4183 Pahom on Water
    POJ 1966 Cable TV Network
    HDU 3605 Escape
    HDU 3338 Kakuro Extension
    HDU 3572 Task Schedule
    HDU 3998 Sequence
    Burning Midnight Oil
  • 原文地址:https://www.cnblogs.com/Sunny20181123/p/11505601.html
Copyright © 2011-2022 走看看