RSS

Monthly Archives: June 2011

K2.ActivityInstanceDestination.User is NULL?????

This 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!

 
6 Comments

Posted by on June 10, 2011 in K2 Workflows

 

28025 Failed to Start IPC

I came across this error again and it reminded me that I’ve come across it a number of times before, so I’ll list the possible issues here:

  1. You don’t have rights to start the child process. When you set up the IPC call the default authentication is set to ‘Integrated’ and I often forget to change this to ‘Impersonate’. When I get this 28025 error the first thing I check is whether or not I’ve set the authentication to impersonate and that the user has start rights on the child process.
  2. The data field you’re setting in the child process doesn’t exist. I came across this when I created my data field in the child process while I was going through the wizard to set up the IPC call. The problem was when I finished the wizard and everything compiled and exported, the data field I created hadn’t actually been created. One day if I have time I’ll raise a bug for this…
  3. You’re passing data with incompatible types. You can’t pass a string from the parent process to an int data field in the child process, for example.
 
Leave a comment

Posted by on June 7, 2011 in K2 Workflows