[英]How to Create Case in Microsoft Dynamics CRM 2016 (Version 8) using webservices or REST API in JAVA or C#?
[英]Dynamics CRM 2016 Create and Qualify a Lead Programmatically C#
我正在尝试以编程方式创建一个主要实体,并且我已经读到,在 dynamics crm 2016 中没有更多针对特殊字段的特殊消息。
因此,我从动态 crm 服务器检索数据并将其插入另一个 crm 服务器,而不使用如下特殊消息:
account["statecode"] = new OptionSetValue(1); //inactive
account["statuscode"] = new OptionSetValue(2); //inactive
的问题是,具有在值“1”的引线记录statecode
该装置是一个合格的引线和statuscode
具有值“3”,这意味着也合格。
无论如何,当我尝试插入时,出现以下消息的错误:
3 不是状态代码 LeadState.Open 的有效状态代码
仅供参考, LeadState.Open
有一个值 "0" ,即使我之前提到的领先状态是 "1"。
我不知道究竟是什么问题。
您应该使用SDK 中记录的QualifyLeadRequest
。 与SetState
不同,此消息尚未标记为弃用。 限定潜在客户工作流比设置状态流程更复杂,因为它包括(可选)创建和链接到客户、联系人和机会记录。
以下是来自 SDK 的示例,该示例使用现有account
对潜在客户进行限定以创建opportunity
。
// Qualify the second lead, creating an opportunity from it, and not
// creating an account or a contact. We use an existing account for the
// opportunity customer instead.
var qualifyIntoOpportunityReq = new QualifyLeadRequest
{
CreateOpportunity = true,
OpportunityCurrencyId = currencyId,
OpportunityCustomerId = new EntityReference(
Account.EntityLogicalName,
_accountId),
Status = new OptionSetValue((int)lead_statuscode.Qualified),
LeadId = new EntityReference(Lead.EntityLogicalName, _lead2Id)
};
var qualifyIntoOpportunityRes =
(QualifyLeadResponse)_serviceProxy.Execute(qualifyIntoOpportunityReq);
Console.WriteLine(" The second lead was qualified.");
foreach (var entity in qualifyIntoOpportunityRes.CreatedEntities)
{
NotifyEntityCreated(entity.LogicalName, entity.Id);
if (entity.LogicalName == Opportunity.EntityLogicalName)
{
_opportunityId = entity.Id;
}
}
从中获取此代码的示例具有更多详细信息: https : //msdn.microsoft.com/en-us/library/hh547458.aspx 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.