Why is the count of "WorkflowItem.Actions" is zero?

  • 11 August 2013
  • 2 replies
  • 0 views

Badge +2

Hello Everyone, I just try to do the 'Approved' action in the k2 workflow by programming. But im my code, i always get the  count of "WorkflowItem.Actions" is zero. Is there anything wrong in my code? here is some code snip:


  SourceCode.Workflow.Client.WorklistItem oWli = oConn.OpenWorklistItem(strSN);
                if (oWli != null)
                {


/// the count of oWli.Actions is 0
                    foreach (Action oAct in oWli.Actions)
                    {
                        ddlActions.Items.Add(oAct.Name);
                    }
                }


At the same time, I can view the 'Approved' and Declined" actions in the worklist (in the k2 workspace).  Also the actions can be done.


thanks.


2 replies

Badge +6

I think you are executing the code as a different user. Enable full logging and check the HostServer logs to verify that the correct user is coming thru. You can also run K2HostServer.exe in console mode to see what is happening.

Badge +2

Hi Sujeeth,


Thanks for your reply. Yes, it's the problem of "login user". I just run the code in the VS 2010, and I don't set any ImpersonateUser in it. Now, i add the following code after the K2Connection.Open() method, it works.


K2Connection.ImpersonateUser(useraccount).

Reply