zoukankan      html  css  js  c++  java
  • K2.ActivityInstanceDestination.User is NULL

    his one caught me by surprise! I needed to build up a CSV list of email addresses for all previous task owners for an activity, so the simplest way would be to just append the email address each time we get to the task, right? Apparently not.

    Here’s my code:

    K2.ProcessInstance.DataFields["AllApproversEmailAddresses"].Value = K2.ActivityInstanceDestination.User.Email;
    

    Nothing too complicated. However, running it gave me the dreaded (and oh so informative) “Object reference not set to an instance of an object”. So what’s happening?

    Well, it’s actually not that complicated. Basically when you create any activity the default destination rule is “Plan Just Once” (in fact you don’t even have the option of choosing anything else unless you run the Activity wizard in advanced mode.) Anyway, when this option is chosen the destination instance isn’t actually created, which means that K2.ActivityInstanceDestination will always return null.

    To get around this issue you will need to do the following:

    • Right-click the activity to open the activity properties.
    • Click on the Destination Rule Options tab, and then click the ‘Back’ button on the wizard.
    • Check the box which says “Run this wizard in advanced mode”, then click “Next”.
    • You’ll see that “Plan per slot (no destinations)” is selected. Choose “All at once” and then click through the rest of the wizard.
    • Deploy and test.

    That’s it. Hope that helps someone!

  • 相关阅读:
    Java沉思录之重识String
    【python】 爬虫-爬取新闻
    【大数据】水质分析————(数据预处理)对水质图片的处理
    神经网络 鸢尾花数集预测
    【python 基础】词云
    【数据结构】字符串匹配
    【算法】 分治
    【数据结构】队列
    【数据结构】栈 的 顺序表示
    【数据结构】 线性表 的 链式存储结构
  • 原文地址:https://www.cnblogs.com/rash/p/7693716.html
Copyright © 2011-2022 走看看