CRM C# - 自定义工作流活动 - 输入参数 - EntityReference

时间:2016-08-12 10:01:24

标签: c# crm

我正在制作一个自定义的worflow活动,正在进行中。我有两个输入是EntityReference。当我测试代码时,我看到一个引用这两个输入的错误,如图所示: enter image description here 我在尝试开始时有一个痕迹,但没有显示。 我的代码是:

 public class WK_DecorrerObjetivo : CodeActivity
{
    [Input("Alvo")]
    [ReferenceTarget("xpto_alvo")]
    public InArgument<EntityReference> alvo { get; set; }

    [Input("Actividade do Objetivo")]
    [ReferenceTarget("xpto_atividadedeobjetivo")]
    public InArgument<EntityReference> atividadeObjetivo { get; set; }

    protected override void Execute(CodeActivityContext Execontext)
    {

        ITracingService _tracing;
        IWorkflowContext context = null;
        IOrganizationServiceFactory serviceFactory = null;
        IOrganizationService service = null;  
        OrganizationServiceContext serviceContext = null;

        try
        {
            #region Get Work Flow Context

            context = Execontext.GetExtension<IWorkflowContext>();
            serviceFactory = Execontext.GetExtension<IOrganizationServiceFactory>();
            service = serviceFactory.CreateOrganizationService(context.InitiatingUserId);
            serviceContext = new OrganizationServiceContext(service);

            _tracing = Execontext.GetExtension<ITracingService>();
            _tracing.Trace("Here");
            EntityReference alvoRef = alvo.Get(Execontext);
            EntityReference atividadeObjetivoRef = atividadeObjetivo.Get(Execontext);
          }
          catch() {}
       }

有人可以帮忙吗?

0 个答案:

没有答案