Dynamic 365-无法从Json文件更新Dynamics crm中的相关实体数据

问题描述

我的要求是根据JSON输入更新Dynamics CRM帐户实体。对于“帐户”中的直接字段,我可以对其进行更新,但是我正在与相关实体苦苦挣扎。

JSON:

{
  "id": "C76B4E57-5BAC-EA11-A812-000D3AD773FF","name": "3000005170","description": "\"\"FISHING-TV\" LLC Support","status": "Active","statusReason": "Active","engagedParty": {
    "id": "ae8e617a-45ac-ea11-a812-000d3ad773ff","name": "\"\"FISHING-TV\" LLC","@referredType": "Organization"
  },"agreement": [
    {
      "id": "7a94566e-73b1-ea11-a812-000d3ab958aa","name": "201498-0000 <D365 UI: Contract.SES TN DB: opportunity.ses_sestn Comment: >"
    }
  ]
}

我的模型班:

public class AccountExtranet {
  public string id {
    get;
    set;
  }
  public string name {
    get;
    set;
  }
  public string description {
    get;
    set;
  }
  public string status {
    get;
    set;
  }
  public string statusReason {
    get;
    set;
  }
  public Engagedparty3 engagedParty {
    get;
    set;
  }
  public List <Agreement3> agreement {
    get;
    set;
  }
  public List <Characteristic5> characteristic {
    get;
    set;
  }
  public List <Contactmedium3> contactMedium {
    get;
    set;
  }
  public ValidforExt validFor {
    get;
    set;
  }
}

我正在通过其更新的类文件

private static void UpdateAccount(CrmServiceClient crmclient,List <Account> allAccount,AccountExtranet extranetAccount,TraceWriter log) {
  Account account = allAccount.FirstOrDefault();
  account.Name = extranetAccount.description;
  AccountState statecode;
  bool statusExist = Enum.TryParse <AccountState> (extranetAccount ? .status,out statecode);
  if (statusExist) {
    account.StateCode = statecode;
  }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)