更新消息(CrmService)动态4.0

时间:2014-10-24 11:39:48

标签: dynamics-crm dynamics-crm-4 dynamics-crm-2013

我想更新“cs_hv_additionnalparticularities”,“cs_hv_smscope”等字段,但函数srv.Update(de);会更新所有表单记录,我的意思是它触发了一个工作流程我不希望它发生。 这是我的代码:

 // Retrieve the DynamicEntity that goes with target
        RetrieveRequest retrieve = new RetrieveRequest();
        retrieve.Target = target;
        retrieve.ColumnSet = new AllColumns();
        retrieve.ReturnDynamicEntities = true;
        // Create a response reference and execute the retrieve request.
        RetrieveResponse response1 = (RetrieveResponse)srv.Execute(retrieve);
        DynamicEntity de = (DynamicEntity)response1.BusinessEntity;


            if (opp.Properties.Contains("cs_hv_additionnalparticularities"))
                de["cs_hv_additionnalparticularities"] = opp["cs_hv_additionnalparticularities"];
            if (opp.Properties.Contains("cs_hv_smscope"))
                de["cs_hv_smscope"] = opp["cs_hv_smscope"];
            if (opp.Properties.Contains("cs_hv_ugscope"))
                de["cs_hv_ugscope"] = opp["cs_hv_ugscope"];
            if (opp.Properties.Contains("cs_hv_acdc"))
                de["cs_hv_acdc"] = opp["cs_hv_acdc"];
            if (opp.Properties.Contains("cs_hv_smmv"))
                de["cs_hv_smmv"] = opp["cs_hv_smmv"];
            if (opp.Properties.Contains("cs_hv_smhv"))
                de["cs_hv_smhv"] = opp["cs_hv_smhv"];
            if (opp.Properties.Contains("cs_hv_ughv"))
                de["cs_hv_ughv"] = opp["cs_hv_ughv"];
            if (opp.Properties.Contains("cs_hvid"))
                de["cs_hvid"] = opp["cs_hvid"];
            de["cs_generercable"] = new CrmBoolean(true);

           srv.Update(de);

我不想使用此函数srv.Update(de);来更新字段。 有人可以给我一些可以做这项工作的更新功能代码吗?

1 个答案:

答案 0 :(得分:0)

如果您不想更新其他列,只需检索特定列(属性ColumnSet)而不是new AllColumns()

您只能使用Update方法更新记录,确保您的工作流仅触发所请求的字段,而不是其他字段。