Я пытаюсь написать собственный рабочий процесс для Microsoft Dynamics CRM 2011 в качестве учебного упражнения. Код, который я использовал, приведен ниже, который отлично подходит для стандартного плагина, но при запуске как части пользовательского рабочего процесса мне предоставляется ключ, отсутствующий в ошибке словаря. Может ли кто-нибудь понять причину этого? Я проверил имена объектов и полей, которые являются правильными.Пользовательский рабочий процесс Microsoft CRM - ключ не найден
Благодаря
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Collections.ObjectModel;
using System.Activities;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Workflow;
using Microsoft.Xrm.Sdk.Query;
using Microsoft.Xrm.Sdk.Messages;
using System.Diagnostics;
namespace TestWflow
{
public class SampleCustomActivity : CodeActivity
{
protected override void Execute(CodeActivityContext executionContext)
{
//Activity code
// Get the context service.
IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
// Use the context service to create an instance of IOrganizationService.
IOrganizationService service = serviceFactory.CreateOrganizationService(context.InitiatingUserId);
if (context.Depth == 1)
{
Entity targetCont = null;
targetCont = (Entity)context.InputParameters["Target"];
Guid contID = targetCont.Id;
ColumnSet contCols = new ColumnSet("jobtitle");
targetCont = service.Retrieve("contact", contID, contCols);
targetCont.Attributes["jobtitle"] = "test jobtitle here";
service.Update(targetCont);
}
}
}
}
Как обжиг рабочий процесс? – Bvrce
Я запускаю его вручную в минуту. – user2463758
Попробуйте новый ColumnSet (true) – Bvrce