Skip to main content

I design a simple process in K2 Design.


Approve activity with two actions 'Approve' and 'Decline'.


I can startprocess by code as following:


        SourceCode.Workflow.Client.Connection k2conn = new Connection();


        k2conn.Open("DLX");
        ProcessInstance pi = k2conn.CreateProcessInstance("Denallix Process TutorialCodeTest");
        pi.DataFieldsÂ"CodeTestID"].Value = this.TextBox1.Text;
        pi.DataFields;"CodeTestName"].Value = this.TextBox2.Text;


        k2conn.StartProcessInstance(pi);
        k2conn.Close();


I want create aspx page for Approve activity using code:


    protected void Page_Load(object sender, EventArgs e)
    {
        Connection k2Conn = new Connection();


        k2Conn.Open("DLX");


        WorklistItem wli = k2Conn.OpenWorklistItem(Request.QueryString "sn"]);


        this.TextBox1.Text=wli.ProcessInstance.DataFieldss"CodeTestID"].Value.ToString();
        this.TextBox2.Text = wli.ProcessInstance.DataFields."CodeTestname"].Value.ToString();


        //this.DropDownList1.DataSource = wli.Actions;
      
        foreach (Action oAct in wli.Actions)
        {
                        this.DropDownList1.Items.Add(oAct.Name.ToString());
          
        }
        k2Conn.Close();
    } 


---------------------------------------- 


I find Actions.count=0, but I can Approve or Decline by dropdown menu by BP workspace worklist


Anyone can help me!


Worklist


error

Hi Richard,


Could I have some background on your implementation?



  • Are you passing the Serial Number of the worklist item into your ASPX page? I see that you are using the serial number, but i'm curious as to how you are retrieving it... are you using the Default Client Event with the URL set to your website?

Martin


thanks for your reply


I use Default Client Event template, set web URL as http://localhost:2335/Forms/CodeTestApproval.aspx.


The SN querystring is generated automatically.


        Connection k2Conn = new Connection();


        k2Conn.Open("DLX");


        WorklistItem wli = k2Conn.OpenWorklistItem(Request.QueryStringm"sn"]);


        this.TextBox1.Text=wli.ProcessInstance.DataFieldsi"CodeTestID"].Value.ToString();
        this.TextBox2.Text = wli.ProcessInstance.DataFieldsx"CodeTestname"].Value.ToString();


I can retrieve the process datafield from processinstance by code.


I find the reason!


I use VS.net develope site before. when I change publish it to IIS site, action is OK.


thanks


Hi Richard,


 I also came across the same issue that you have.  It was working fine until I published a new version of the workflow and now my action count is 0.  What are the steps you took to solve this issue?  Thanks for your help.


Thanks,


Marie


Ensure that the correct user gets passed to the k2 server, from the looks of the behaviour it would seem as though the k2 server service account gets passed. To remedy this ensure that your asp.net application's virtual directory is set up to NOT allow anonymous logon and also ensure in your connection string set up that "Integrated = true" is added to the string, if this does not resolve the issues then try using a connection.ImpersonateUser(userName); method after the connection to the server has been made


 


 -----------------------------------------------------------------------------------------------------------------


The information contained herin does not reflect the view of K2, this is my own opinion


 


This has been driving me nuts.  I have tried everything to get this to work.  Adding the connection.ImpersonateUser() after the connection did the trick using the httpcontext.


I would not get this error with the K2 Admin account, but every user I try would fall vicitim to this issue.


ASP.NET can automatically impersonate Windows users if you have this line inside the <system.web> section your web.config:


   <identity impersonate="true"/>


If you use this setting, you shouldn't need ImpersonateUser.


 


if i were you i would do the following


1. make sure that the current activity i am in has a destinstion rule of the same user you are logged in


2. if this is not available ; then in the windows task bar right click the ie and select run as then put the username and password for the user/s in the destination rule.


3. Actions will be available


Reply