Skip to main content

Hi,

I have developed a custom workflow using my own ASPX page.  One of these pages I have specified as the association form.  Now the Page_Load even fires when the page loads, within this Page_Load even I want access to the current ProcessInstance.  How do I get access to this.

Thanks

Arjuna.

Hi Arjuna,


 Have a look at the help files, or the developer reference/SDK it is full of sample code and examples of this. The following is a slightly modified version that should get you going...


public void ActionWorklistItem()


        {


            // TODO: Replace these placeholder values with values for your environment


            string _serverName = "blackpearl";


            string _user = "K2Student";


            string _domain = "DENALLIX";


            string _password = "K2pass!";


            string _wfSerialNumber = "4_12";


            string _action = "Manager Reviewed";


 


            SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder connectionString = new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder();


 


            connectionString.Authenticate = true;


            connectionString.Host = "localhost";


            connectionString.Integrated = true;


            connectionString.IsPrimaryLogin = true;


            connectionString.Port = 5252;


            connectionString.UserID = _user;


            connectionString.WindowsDomain = _domain;


            connectionString.Password = _password;


            connectionString.SecurityLabelName = "K2"; //the default label


 


            // open a K2 connection


            Connection connection = new Connection();


            connection.Open(_serverName, connectionString.ToString());


 


            try


            {


                // open the worklist item


                connection.OpenWorklistItem(_wfSerialNumber);


                worklistItem.Actionssaction].Execute();


            }


            catch (Exception ex)


            {


                // write error to console


                //Console.WriteLine("Error: " + ex.Message);


                //Console.ReadLine();


                throw();


            }


 


            finally


            {


                // close the connection


                connection.Close();


            }


        }


Reply