Accessing the current process instance

Last post 07-18-2008, 5:33 AM by GLouw. 1 replies.
Sort Posts: Previous Next
  •  07-18-2008, 1:52 AM 24953

    Accessing the current process instance

    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.

  •  07-18-2008, 5:33 AM 24959 in reply to 24953

    Re: Accessing the current process instance

    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.Actions[action].Execute();

                }

                catch (Exception ex)

                {

                    // write error to console

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

                    //Console.ReadLine();

                    throw();

                }

     

                finally

                {

                    // close the connection

                    connection.Close();

                }

            }


    Gerhard
    -----------------------------------------------------------------------------
View as RSS news feed in XML