Create a process instance using AgilePoint's Workflow API

Expand / Collapse
 
     

Create a process instance using AgilePoint's Workflow API


The information in this article applies to:

  • AgilePoint Developer

GOAL(S)
  To provide information about creating a process instance using AgilePoint's Workflow API.
   
SUMMARY
  The file attached below provides a samle project and source code for creating a process instance using AgilePoint's Workflow API.
   
SOLUTION
 

Below is the sample code from the CreateProc.cs file.

using System;
using Ascentn.Workflow.Base;

namespace Ascentn.HowTo
{
    ///
<summary>
    ///
Summary description for CreateProc.
    /// </summary>

    class
CreateProc
    { 
        /// <summary>
 
        /// The main entry point for the application.

        /// </summary>
 
        [STAThread]
        static void Main(string
[] args)
        {
            string
agilePointUrl = "http://localhost:8088/AgilePointServer";

            try
            {

                // Instantiate a workflow api object
                WorkflowService api = new
WorkflowService(agilePointUrl);
                // Set credentials
                api.Credentials = System.Net.CredentialCache.DefaultCredentials;

                // process template name must be same as the one designed by AgilePoint Envision
                string
processTemplateName = "NewHire";

                // get UUID of released process definition string pid = api.GetReleasedPID(processTemplateName);
                // Generate a unique process instance ID string piid = Ascentn.Workflow.Base.UUID.GetID();
                // Create a unique name for the process instance string piname = "MyProcess_" + DateTime.Now.ToString("MMdd-HHmmss");
                // Create a unique work object ID;
                string workObjectId = string
.Format("MyProcess-{0}",UUID.GetID());

                string superPIID = null; // No parent process ID in this example
                string customID = null
;

                string attrVal1 = "Testing one";
                bool attrVal2 = false
;

                // Initialize custom process attributes
                NameValue[] attrs = NameValue.Array(
                    "MyAttrOne", attrVal1,
                    "MyAttrTwo", attrVal2
                    );

                // Start the process
                WFEvent evt = api.CreateProcInstEx(pid,
                    piid,
                    piname,
                    workObjectId,
                    superPIID,
                    customID,
                    attrs,
                    true
);

                Console.Write("Started: " + piname);
            }
            catch (Exception ex)
            {
                Console.Write("Error: " + ex.Message);
            }
        }
    }
}

   
Last Reviewed:  
Keywords:  

Attachments



Add Your Comments


Name: *
Email Address:
Web Address:
Verification Code:
*
 

Details
Last Modified:Friday, September 15, 2006
Last Modified By: Brian A
Type: HOWTO
Article not rated yet.
Article has been viewed 1,972 times.
Options