Related Topics
Process Class
This object represents a Process (definition and/or instance).
This object is derived from the ContentObject class. All properties and methods from the ContentObject are supported for this object, plus the properties below.
Properties
PROPERTY NAME |
DATA TYPE |
DESCRIPTION |
---|---|---|
Attachments |
List Object |
Attached files or documents for the process, returned as a List<Document Object>. |
DefaultForm |
Form Object |
Default form definition for the process |
DefaultFORMINSTID |
String |
Default form instance ID for the process |
DueTime |
DateTime |
The date/time the process instance is due |
EndTime |
DateTime |
The date/time the process instance ended |
Error |
Boolean |
Whether the process is in an error state |
Initiator |
User Object |
Process initiator |
InstanceName |
DefaultForm |
Name of the process instance |
InstanceObject |
Content List Object |
The optional content object of this process instance |
InstID |
String |
ID of the process instance |
ParentInstanceObject |
Content List Object |
The optional content object of the parent process instance |
Priority |
Integer |
The priority of the process instance |
RunningTasks |
List Object |
List of running tasks in the process, returned as List<Task> |
StartTime |
DateTime |
The date/time the process instance started |
Status |
Integer |
Status of the process instance, specified in the nStatus field of tblProjectInstance. Please see the table definition of tblProjectInstance for status codes. |
TermReason |
Integer |
If the process instance has ended, the reason. Please see the Classes topic for a list of termination reasons and their associated integer code. |
Methods


Adds a ContentObject object to a Process. This is an overloaded method with the following possible declarations:
public bool AddToProcess(ContentObject pObj)
public bool AddToProcess(ContentObject pObj, string pGroup)
public bool AddToProcess(string pID)
public bool AddToProcess(string pID, string pGroup)
public bool AddToProcess(string pID, ObjectType pType)
public bool AddToProcess(string pID, ObjectType pType, string pGroup)
Parameters
pObj: A Process Director ContentObject object.
pGroup: The string name of a Group to which the object should be added.
pID: The string ID of the Object.
pType: The ObjectType of the Object to be added.
Returns
Boolean: True if the operation succeeds.
Example
// Set the Process and content object
var oProcess = Project.GetProcessByID(bp, "PRID");
var oObject = Form.GetFormByFORMID("FORMID");
// Add the object to the process
oProcess.AddToProcess(oObject);


This API converts system variables in a string.
Parameters
String: The string in which to find the system variables.
pDefaultEncode: The BP SysVar Encode method.
Returns
String: The resultant string after converting every system variable.
Examples
var oProcessInst = Project.GetProcessByInstID(bp, "PRINSTID");
bp.log0(oProcessInst.ConvertSysVarsInString("Created on {CREATE_DATE}"));


This API will get all children of the Process Instance.
Parameters
ObjectType: Optional filter of object types to return.
MapType: Optional filter of map types to return.
GroupName: Optional filter of items in a Group to return.
Returns
List<ContentObject>: List of ContentObjects or null if the operation fails.
Example
var oProcessInst = Project.GetProcessByInstID(bp, "PRINSTID");
// Gets all items in the group named “Group 1”
var MyChildren = oProcessInst.GetChildren("Group 1");


This API will return a process object from the specified ID.
Parameters
BP: The bp environment.
pInstID: The ID of the process instance object to retrieve.
Returns
ProcessInstanceObject: Will return null if object isn't found.
Example
// Normally not used directly
var oObject = Process.GetProcessByInstID(bp, "PRINSTID" );


This API will write the instantiate a Process Definition. After instantiating the Process, you can optionally add items to the Process Instance (using Add). Finally, you must call the Start method to actually run the instantiated Process. This is an overloaded method with the following possible declarations:
public bool Instantiate()
public bool Instantiate(Process procParent)
public bool Instantiate(string InitiatorUID)
public bool Instantiate(string InitiatorUID, Process procParent)
Parameters
procParent: The name of the Process Task to get.
InitatorUID: The User ID of the process initiator.
Returns
Boolean: True if the operation succeeds.
Example
var oProcess = Project.GetProcessByID(bp, "PRID");
oProcess.Instantiate();
// Add items to Timeline package here
oProcess.Start();


This API will post an event to a process. This is an overloaded method with the following possible declarations:
public static bool PostEvent(bp BP, string PRINSTID, string EventName)
public virtual bool PostEvent(string EventName)
Parameters
BP: The BP Logix environment.
PRINSTID: The ProcessInstanceID of the process.
EventName: The string name of the event to post.
Returns
Boolean: True if the operation succeeds.
Example
PostEvent(bp, "PRID", "EventName");


This API will start a Process instance which has previously completed. You can optionally pass the ProcessTask or TASKID of the step to start. If neither is passed, the Process will restart at the beginning. This is an overloaded method with the following possible declarations:
public bool ReStart()
public bool ReStart(string pTASKID)
public bool ReStart(ProcessTask pTask)
Parameters
pTaskID: The string ID of the task to restart.
pTask: The actual task object to restart.
Returns
Boolean: True if the operation succeeds.
Example
// Restarts the Process instance
var oProcessInst = Project.GetProcessByInstID(bp, "PRINSTID");
oProcessInst.ReStart();


This API will instantiate and start a process definition in one step. You can optionally add a single item to the Process. This is an overloaded method with the following possible declarations:
public bool Run()
public bool Run(string pID, ObjectType pType)
public bool Run(string pID, ObjectType pType, string pGroup)
public bool Run(ContentObject pObj)
public bool Run(ContentObject pObj, string pGroup)
Parameters
Group: Optional Group of the object to add to the process.
pID: Optional ID of the object to add to the process.
pObj: Optional ContentObject to run.
pType: Optional Type of the object to add to the process.
Returns
Boolean: True if the operation succeeds.
Example
var oProcess = Project.GetProcessByID(bp, "PRID");
oProcess.Run();


This API will set the current Form Instance (the default Form Instance which will be used to complete tasks) for a Process Instance. The Process must already contain a reference to the Form Instance. This is an overloaded method with the following possible declarations:
public bool SetCurrentFormInstance(ContentObject pObj)
public bool SetCurrentFormInstance(string pFORMINSTID)
Parameters
FORMINSTID: The form instance ID to make the current.
pObj: The ContentObject to make current.
Returns
Boolean: True if the operation succeeds.
Example
// Set the specified form instance as the current form instance
var oProcessInst = Project.GetProcessByInstID(bp, "PRINSTID");
oProcessInst.SetCurrentFormInstance("FORMINSTID");


This API will set the priority of a Process Instance.
Parameters
pPriority: The integer priority to set.
Returns
Boolean: True if the operation succeeds.
Example
var oProcessInst = Process.GetProcessByInstID("PRINSTID");
oProcessInst.SetPriority(1);
Documentation Feedback and Questions
If you notice some way that this document can be improved, we're happy to hear your suggestions. Similarly, if you can't find an answer you're looking for, ask it via feedback. Simply click on the button below to provide us with your feedback or ask a question. Please remember, though, that not every issue can be addressed through documentation. So, if you have a specific technical issue with Process Director, please open a support ticket.