CRM 2011:自定义工作流活动的输出参数鸵鸟政策秀(CRM 2011: Custom Workf

2019-11-02 00:59发布

大家好,我有没有出现在输出参数列表右侧的“查找”下面“本地值”下,我不明白的问题或原因不会出现,因为在输入参数的上的问题好的。

protected override void Execute(CodeActivityContext executionContext)
        {
            ITracingService tracingService = executionContext.GetExtension<ITracingService>();

            //Create the context
            IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
            IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
            IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

            tracingService.Trace("Creating Account");

            Account entity = new Account();
            entity.Name = AccountName.Get<string>(executionContext);
            Guid entityId = service.Create(entity);

            string a = entity.Name;

            AccountNameTest.Set(executionContext, a);

            tracingService.Trace("Account created with Id {0}", entityId.ToString());

            tracingService.Trace("Create a task for the account");
            Task newTask = new Task();
            newTask.Subject = TaskSubject.Get<string>(executionContext);
            newTask.RegardingObjectId = new EntityReference(Account.EntityLogicalName, entityId);

            Guid taskId = service.Create(newTask);

            tracingService.Trace("Task has been created");

            tracingService.Trace("Retrieve the task using QueryByAttribute");
            QueryByAttribute query = new QueryByAttribute();
            query.Attributes.AddRange(new string[] { "regardingobjectid" });
            query.ColumnSet = new ColumnSet(new string[] { "subject" });
            query.EntityName = Task.EntityLogicalName;
            query.Values.AddRange(new object[] { entityId });

            tracingService.Trace("Executing the Query for entity {0}", query.EntityName);

            //Execute using a request to test the OOB (XRM) message contracts
            RetrieveMultipleRequest request = new RetrieveMultipleRequest();
            request.Query = query;
            Collection<Entity> entityList = ((RetrieveMultipleResponse)service.Execute(request)).EntityCollection.Entities;

            //Execute a request from the CRM message assembly
            tracingService.Trace("Executing a WhoAmIRequest");
            service.Execute(new WhoAmIRequest());

            if (1 != entityList.Count)
            {
                tracingService.Trace("The entity list was too long");
                throw new InvalidPluginExecutionException("Query did not execute correctly");
            }
            else
            {
                tracingService.Trace("Casting the Task from RetrieveMultiple to strong type");
                Task retrievedTask = (Task)entityList[0];

                if (retrievedTask.ActivityId != taskId)
                {
                    throw new InvalidPluginExecutionException("Incorrect task was retrieved");
                }

                tracingService.Trace("Retrieving the entity from IOrganizationService");

                //Retrieve the task using Retrieve
                retrievedTask = (Task)service.Retrieve(Task.EntityLogicalName, retrievedTask.Id, new ColumnSet("subject"));
                if (!string.Equals(newTask.Subject, retrievedTask.Subject, StringComparison.Ordinal))
                {
                    throw new InvalidPluginExecutionException("Task's subject did not get retrieved correctly");
                }

                //Update the task
                retrievedTask.Subject = UpdatedTaskSubject.Get<string>(executionContext);
                service.Update(retrievedTask);
            }
        }
        //
        [Input("Name conta")]
        [Default("testv01")]
        public InArgument<string> AccountName { get; set; }

        [Input("Task")]
        [Default("testv01")]
        public InArgument<string> TaskSubject { get; set; }

        [Input("Update task")]
        [Default("testUPDATED:v01}")]
        public InArgument<string> UpdatedTaskSubject { get; set; }

        [Output("Account ID Guid")]
        [Default("testUPDATED:v01")]
        public OutArgument<string> AccountNameTest { get; set; }

Answer 1:

好了,问题解决了,只需重新启动IIS承担的字段,或通过版本变化。 问题是该插件的更新,这也与工作流程发生。 根据CRM 4.0,我意识到这种情况不会在CRM 4.0发生。



Answer 2:

尽管这个问题已经回答了我想分享两个案例,这个解决方案没有工作(即使在最近的CRM的版本):

情况1

有choosen输入参数,名称包含德语变音(äöüß)。

IIS重启没有帮助。 没有变音符号选择名称解决了这个问题对我来说。

案例2

我们最近也有采用通常的所有参数并没有露面,甚至重新启动整个Maschine CRM正在运行后的情况。 解决的办法是不很明显的:

  1. 从SDK开放PluginRegistrationTool
  2. 选择包含CWA大会
  3. 选择您的CWA
  4. 按下储存键式在CWA的属性,标签


文章来源: CRM 2011: Custom Workflow Activity Output Parameters don´t show