0

大家,我有一个问题没有出现在“Local Values”下的“Look for”下右侧的输出参数列表中,我不明白问题或没有出现的原因,因为就输入参数而言好的。

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; }
4

2 回答 2

0

好的,问题解决了,只需重新启动 IIS 以假设字段,或通过版本更改。问题在于插件的更新,工作流程也会发生这种情况。根据 CRM 4.0,我意识到这种情况在 CRM 4.0 中不会发生。

于 2013-04-23T12:17:33.923 回答
0

即使已经回答了这个问题,我还是想分享两个该解决方案不起作用的案例(即使在最新版本的 CRM 中):

情况1

已选择包含德语变音符号 (äöüß) 的输入参数名称。

IIS 重新启动没有帮助。选择没有变音符号的名称为我解决了这个问题。

案例2

我们最近还遇到了一个正常的 In-Argument 没有出现的案例,即使在重新启动整个 Maschine CRM 运行之后也是如此。解决方案并不明显:

  1. 从 SDK 打开 PluginRegistrationTool
  2. 选择包含您的 CWA 的程序集
  3. 选择您的 CWA
  4. 点击 CWA 属性选项卡中的保存按钮
于 2017-08-09T08:54:03.160 回答