0

记录可以创建为已关闭吗?

如果我创建记录然后更改状态,那可能会起作用,但是否可以一步完成?

我正在使用 ExecuteMultipleRequest 创建案例。

4

3 回答 3

2

不,您必须提出两个请求才能创建和解决案例。请参阅以下示例:

// Create an incident.
var incident = new Incident
{
    CustomerId = new EntityReference(Account.EntityLogicalName, _accountId),
    Title = "Sample Incident"
};

_incidentId = _serviceProxy.Create(incident);

// Create the incident's resolution.
var incidentResolution = new IncidentResolution
{
    Subject = "Resolved Sample Incident",
    IncidentId = new EntityReference(Incident.EntityLogicalName, _incidentId)
};

// Close the incident with the resolution.
var closeIncidentRequest = new CloseIncidentRequest
{
    IncidentResolution = incidentResolution,
    Status = new OptionSetValue((int)incident_statuscode.ProblemSolved)
};

_serviceProxy.Execute(closeIncidentRequest);

参考:sdk\Sa​​mpleCode\CS\BusinessDataModel\Service\CloseAnIncident.cs

于 2013-08-30T12:57:37.780 回答
1

您将始终需要两个请求,一个用于创建记录,一个用于更改状态。

于 2013-08-30T12:43:01.650 回答
1

您可以让插件在创建时关闭记录,这样它就发生在同一个数据库事务中,但我猜这不值得。

于 2013-08-30T12:44:10.043 回答