CRM - QualifyResponse仅在创建两个实体时返回一个实体

时间:2016-05-21 03:54:36

标签: c# dynamics-crm dynamics-crm-2013

我在使用" QualifyLeadResponse"时遇到问题。来自CRM的课程。我正在使用" QualifyLeadRequest"创建机会和联系人,但当我得到答复时,它只包含机会。

但是,如果我进入CRM并且看起来确实会创建一个联系人。从截图中可以看出,实体的计数只有1,即使有两个已创建。不知道我在这里做错了什么。为什么只返回一个实体? enter image description here

 QualifyLeadRequest qualifyLead = new QualifyLeadRequest
                        {
                            LeadId = new EntityReference(crmLead.LogicalName, leadId),
                            Status = new OptionSetValue(3),
                            CreateOpportunity = true,
                            CreateContact = true
                        };


                        Console.WriteLine("Lead created.");

                        var qualifyIntoOpportunityAndContact = (QualifyLeadResponse)userProxy.Execute(qualifyLead);
                        Console.WriteLine("Lead qualified.");
                        foreach (var entity in qualifyIntoOpportunityAndContact.CreatedEntities)
                        {
                            if (entity.LogicalName == "opportunity")
                            {
                                opportunity.Id = entity.Id;
                                userProxy.Update(opportunity);
                            }
                        }

0 个答案:

没有答案