Цитата:
Сообщение от
a33ik
Зависит конечно от задачи, но как по мне - самое надёжное это плагин в такого рода задачах.
Да мне тоже ближе как-то через плагин сделать, но пока не получается создать бизнес-процесс с его участием. После добавления шага вызова сборки при попытке добавить следующий шаг выдается ошибка
Цитата:
Error: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Error Message: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Source File: Not available
Line Number: Not available
Request URL:
http://10.160.105.2:5555/zat611/AppW.../Workflow.asmx
Stack Trace Info: [ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
Плагин пока простейший, чисто убедиться, что будет работать:
Код:
using System;
using System.Collections;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using System.Reflection;
using Microsoft.Crm.Workflow;
using Microsoft.Crm.Sdk;
using Microsoft.Crm.SdkTypeProxy;
using Microsoft.Crm.Sdk.Query;
namespace Miratech.Miro.CrmPlugin
{
[CrmWorkflowActivity("PayDirection.AktInsurance.OnChange")]
public class PayDirectionAktInsuranceChange : Activity
{
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
InsContract = new Lookup("new_ins_contract", new Guid("BEB08AF1-5723-DE11-A1E5-0016E68BF392"));
return base.Execute(executionContext);
}
public static DependencyProperty InsAktProperty =
DependencyProperty.Register("InsAkt", typeof(Lookup), typeof(PayDirectionAktInsuranceChange));
[CrmInput("InsAkt")]
[CrmReferenceTarget("new_ins_akt")]
public Lookup InsAkt
{
get
{
return (Lookup)base.GetValue(InsAktProperty);
}
set
{
base.SetValue(InsAktProperty, value);
}
}
public static DependencyProperty InsContractProperty =
DependencyProperty.Register("InsContract", typeof(Lookup), typeof(PayDirectionAktInsuranceChange));
[CrmOutput("InsContract")]
[CrmReferenceTarget("new_ins_contract")]
public Lookup InsContract
{
get
{
return (Lookup)base.GetValue(InsContractProperty);
}
set
{
base.SetValue(InsContractProperty, value);
}
}
}
}
Взял пример с СДК, немного видеоизменил под свои нужды.
Теперь сижу, думаю, что такая ошибка может значить.