Skip to main content

Greetings,

I want to get the details of the;

  • Process deployed on the server
  • Activity available in the process
  • Events inside the Activity

 Please let me know how we can get this information in the K2 lack Pearl

 Thanks,

Aman 

Hi,


You have several ways to get these information, but it depends on where you are when you need it (in design, in a web app, in moss etc etc...).


Programmaticly talking, you can use the Sourcecode.Workflow.Management API and the following methods :



  • GetProcess
  • GetProcessActivities
  • GetActivityEvents

but at this point we aren't on the instance world... we will have design details.


I don't know if it make sense. If not, please clarify a little your need ;-)


Greetings Jan,

Thanks a lot for the quick information.

Application is developing in ASP.NET C# application 2.0 framework. There is a need that a page needs to be developed where the user can select the process name which are available on the server for which he has access to. Then he will select the Activity name and enter the user role who can work on that activity. The roles which he can use should also come from the K2 BlackPearl which admin has defined. The same roles will also be configured in MSAD. During Runtime the process has to select the user form the MSAD.

To achieve this I  was thinking to get the Process names using the method GetProcess() and activities using GetProcessActivities(). I tried using the methods defined, but I was getting an error "Not Connected". The connection with server is successful. Could you please tell me what could be the problem and how can I get the collection of Processes and Activities?

Please provide some information to achieve the information.

 


Hi,


To be connected, please use before the Open() Method on the WorkflowManagementServer Object. See this post to have a sample: http://k2underground.com/forums/thread/19762.aspx


Keep in mind, that to execute Management API on a process, you need to have "Admin" rights on the process.


Alternatively, you can use SmartObjects. Actually, K2 exposes their processes and activities throw Workflow SmartObjects and you can request them using API or ADO.net DataProvider. See this post to have a better understanding: http://k2underground.com/blogs/fromthebench/archive/2008/06/02/how-to-retrieve-process-instance-reporting-data.aspx


HTH


Hi,

Thanks for the information provided. That was very much useful understand the concepts in Managing the server information.

I have set the Admin rights to the user who is suppose to assign the users at runtime for the activity in a process. But I was not able to get the list of Processes deployed on the server.

With the following code I can get all the information only by passing the ProcessSetID. How can I get the ProcessSetID?

        WorkflowManagementServer BPM = new WorkflowManagementServer("ServerName", 5555);
        BPM.Open();

        if (BPM.GetProcessFolders().Count > 0)

        { //Fill the process dropdown list

            ddlProcessNames.DataSource = BPM.GetProcesses(int ProcSetID);
            ddlProcessNames.DataBind();

        }

 

Thanks


Hurry!

Here are the details how I got the Process and Activity details from K2 using SmartObjects

       SmartObjectClientServer serverName = new SmartObjectClientServer();

        serverName.CreateConnection();
        serverName.Connection.Open("Integrated=True;IsPrimaryLogin=True;Authenticate=True;EncryptedPassword=False;Host=K2Server;Port=5555");

Getting the Process details from K2

 private void LoadProcess(SmartObjectClientServer serverName)
    {
        SmartObject ProcessDetails = serverName.GetSmartObject("Process_Overview");
        ProcessDetails.MethodToExecute = "List";
        SmartObjectList ProcessDetailsList = serverName.ExecuteList(ProcessDetails);
        ddlProcessName.Items.Clear();
        ddlProcessName.Items.Add("e--Select--]");

        foreach (SmartObject data in ProcessDetailsList.SmartObjectsList)
            ddlPr
ocessName.Items.Add(data.Propertiesi"ProcessName"].Value);
    }
 

 Getting the Activity details for the Process

 private void GetActivitiesForProcess(int iProcessID, SmartObjectClientServer serverName)
    {
        #region Getting the Activities for Process

        SmartObject ActivitiesDetails = serverName.GetSmartObject("Process_Activities");
        ActivitiesDetails.MethodToExecute = "List";
        ActivitiesDetails.ListMethods<"List"].InputPropertiesi"Process_ID"].Value =
iProcessID.ToString();
        SmartObjectList ActivitiesList = serverName.ExecuteList(ActivitiesDetails);
        ListBox1.Items.Clear();
        foreach (SmartObject data in ActivitiesList.SmartObjectsList)
            ListBox1.Items.Add(data.Properties;"Activity_Name"].Value);

        #endregion
    }

 

 Cheers!

 

 


Reply