我需要为SharePoint文档库构建文档批准工作流程。 Workflow需要与OOTB批准工作流程完全相同,但允许批准者依赖于文档中的元数据字段。例如,人力资源文件需要通过审批人批准,但财务文件需要通过审批人批准。

我副本的ootb批准工作流,并希望通过添加一个操作来设置验证参数的值来自定义它,如此所示 (在真实工作流中,我将添加一个条件来设置参数的实际值,但现在我只需要确保此方法正在工作)。

我设置验证参数的值为:

<d:Approvers xmlns:d="http://schemas.microsoft.com/office/infopath/2009/WSSList/dataFields"
       xmlns:pc="http://schemas.microsoft.com/office/infopath/2007/PartnerControls">
  <d:Assignment>
    <d:Assignee>      
      <pc:Person>
        <pc:DisplayName>Approver1</pc:DisplayName>
        <pc:AccountId>DEMO\approver1</pc:AccountId>
        <pc:AccountType>User</pc:AccountType>
      </pc:Person>
    </d:Assignee>
    <d:Stage xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
    <d:AssignmentType>Serial</d:AssignmentType>
  </d:Assignment>
</d:Approvers>
.

我在sp日志中继续收到以下错误:

    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> 
  System.NullReferenceException: Object reference not set to an instance of an object.     
  at Microsoft.Office.Workflow.Actions.StageContainer.UpdateFromString(SPWeb web, SPItemKey itemId, String assignmentString)     
  at Microsoft.Office.Workflow.Actions.OfficeTask.get_ParticipantList()     --- End of inner exception stack trace ---     
  at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)     
  at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)     
  at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)     
  at System.Workflow.ComponentModel.ActivityBindPropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)     
  at System.Reflection.PropertyInfo.GetValue(Object obj, Object[] index)     
  at System.Workflow.ComponentModel.MemberBind.<>c__DisplayClass1.<GetValue>b__0(Object sender, PathMemberInfoEventArgs eventArgs)     
  at System.Workflow.ComponentModel.PathWalker.TryWalkPropertyPath(Type rootType, String path)     
  at System.Workflow.ComponentModel.MemberBind.GetValue(MemberInfo memberInfo, Object dataContext, String path)     
  at System.Workflow.ComponentModel.ActivityBind.GetMemberValue(Object dataSourceObject, MemberInfo memberInfo, String path, Type targetType)     
  at System.Workflow.ComponentModel.ActivityBind.InternalGetRuntimeValue(Activity activity, Type targetType)     
  at System.Workflow.ComponentModel.DependencyObject.GetBoundValue(ActivityBind bind, Type targetType)     
  at System.Workflow.ComponentModel.DependencyObject.GetValueCommon(DependencyProperty dependencyProperty, PropertyMetadata metadata)     
  at Microsoft.SharePoint.WorkflowActions.CoerceActivity.get_Value()     
  at Microsoft.SharePoint.WorkflowActions.CoerceActivity.Coerce()     
  at Microsoft.SharePoint.WorkflowActions.CoerceActivity.Execute(ActivityExecutionContext provider)     
  at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext)     
  at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(Activity activity, ActivityExecutionContext executionContext)     
  at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime)     
  at System.Workflow.Runtime.Scheduler.Run()    49157206-76a1-4fe0-8b74-0567086a80ff
.

任何想法可能是错误的?

环境:Windows 2008 R2,SP2010企业版。

其他提示

如果您设置的任何人或组类型字段,如参数:上面的验证确保将“返回字段作为”毫不含糊地识别您的用户。例如登录名,全名没有。

许可以下: CC-BY-SA归因
scroll top