none
我的工作流错在哪里 RRS feed

  • 问题

  •     [CrmWorkflowActivity("christina")]
     public class shenhe:Activity
     {
             protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
            {  
                IContextService contextservice = (IContextService)executionContext.GetService(typeof(IContextService));
                IWorkflowContext context = contextservice.Context;
                ICrmService crmservice = context.CreateCrmService();

                SecurityPrincipal assignee = new SecurityPrincipal();
                assignee.Type = SecurityPrincipalType.User;
                assignee.PrincipalId = userId.Value;

                TargetOwnedDynamic target = new TargetOwnedDynamic();

                target.EntityId = context.PrimaryEntityId;
                AssignRequest assign = new AssignRequest();
                assign.Assignee = assignee;
                assign.Target = target;
                AssignResponse assignreponse = (AssignResponse)crmservice.Execute(assign);

     

                return base.Execute(executionContext);
            }
             public static DependencyProperty userIdProperty = DependencyProperty.Register("userId", typeof(Lookup), typeof(shenhe));
             [CrmInput("The id")]
             [CrmReferenceTarget("systemuser")]
             public Lookup userId
             {
                 get
                 {
                     return (Lookup)base.GetValue(userIdProperty);

                 }
                 set
                 {
                     base.SetValue(userIdProperty, value);

                 }
             }


     }

    我是想 选择一个人 然后通过工作流i把实体分派给选择的那个人 
    但是不知道错在哪里 

    2010年3月9日 2:18

答案

  • userId 估计取不到值,你给userId赋值了吗

    debug调试下
    Batistuta Cai-刀客 | 蔡敏生 | MS CRM MVP | Blog:http://caims.cnblogs.com
    2010年3月9日 4:31
    版主

全部回复