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);
}
}
}
}