0

我正在做一个工具来在 CRM 和另一个应用程序之间同步一些数据。现在我必须从 EntityReference 中删除该值。我正在尝试这种方式:

contact.ParentCustomerId = null;

但它不起作用。当我通过浏览器访问 CRM 时,这不会给我任何错误,该字段直到 valorized。我也尝试过这种方式:

contact.ParentCustomerId = new EntityReference(Crm.Context.Account.EntityLogicalName, Guid.Empty);

但这给了我一个运行时错误。

我该如何解决?谢谢

更新 :

 Crm.Context.Contact contatto = ContattiTOA.Transform(c, account); //Inside the transform you can see that line of code I posted before..

 var entityToUpdate = this._context
                                .ContactSet
                                .Where(cont => cont.new_SIP_id == contatto.new_SIP_id || cont.Id == contatto.Id)
                                .First();

        if (entityToUpdate.new_SynchronizewithSIP.HasValue && entityToUpdate.new_SynchronizewithSIP.Value == true)
        {
            contatto.Id = entityToUpdate.Id;
            contatto.OwnerId = entityToUpdate.OwnerId;
            contatto.EntityState = EntityState.Changed;

            request = new UpdateRequest { Target = contatto };
        }

        requests.Requests.Add(request);

        ExecuteMultipleResponse responses = (ExecuteMultipleResponse)this._context.Execute(requests);

        foreach (var responseItem in responses.Responses)
        {
            if (responseItem.Fault != null)
            {
                ... // I never fall in here
            }
        }
4

0 回答 0