Problem with actions

  • 24 October 2008
  • 0 replies
  • 0 views

Badge +6

Dear ,

 

I biult a very simple Workflow, with 4 activities, on one of the activities i have a decision to make. 

 

The problem is that on the Client even level i set 2 Action "Approve ", "Reject". 

 

The problem is that when i'm trying to access the actions from my application using the following code: 

 

                    objK2WorkflowConn.Open(setup);
                  
                    SourceCode.Workflow.Client.WorklistItem oWLItem = objK2WorkflowConn.OpenWorklistItem(strSN);
                    if (oWLItem != null)
                    {

                        foreach (Action act in oWLItem.Actions)
                        {
                            if (act.Name == ddlApproval.SelectedText)
                            {
                                act.Execute();
                                break;
                            }
                        }

                    }
                    else
                    {
                        throw( new Exception("AN Error has Occured"));
                    }

 

 

oWLItem.Actions.count = 0 

 

I added the actions using the wizzard in visual studio. 

 

What should i do in order to access the actions and execute them.

 

Thanks a lot 


0 replies

Badge +6

Hi there,


I'm not too sure from your post what exactly the problem is you are getting, but from the code I can make the following recommendation on how to use actions. Hope it helps.


                   
                    SourceCode.Workflow.Client.WorklistItem oWLItem = objK2WorkflowConn.OpenWorklistItem(strSN);
                    if (oWLItem != null)
                    {
                        // instead of doing the foreach do this:


                        oWLItem.Actions[ddlApproval.SelectedText].Execute();
                        //foreach (Action act in oWLItem.Actions)
                        //{
                         //   if (act.Name == ddlApproval.SelectedText)
                         //   {
                          //      act.Execute();
                         //       break;
                         //   }
                        //}

                    }
                    else
                    {
                        throw( new Exception("AN Error has Occured"));
                    }

Reply