I am working on Kofax Total Agility with a basic BPMN (Business Process Model and Notation). This process contains differents steps:
My objective is to make future processes easier to manage by developping modules. In the Workspace, I can import documents and manage all the process and export document in the end and it work fine.
I tried to find in the API documentation the Services and Methods that can be called and used externally. In this process, When I reach the externalCall step of the process I would like to return to the classification step or the document review depending on a value retrieved in the verification step.
Passing a variable from verification to externalCall is easy. My issue is to know how to "move" an activity to a previous step programmatically for one or several document imported in a process. In this case i would like to reassign a document to validation step or extraction step after verification and externalCall in the workflow.
I found method such as ReassignActivity which is in ActivityService. My question would be to know how to get the required variables to make it possible. For example, how do I retrieve the ResourceIdentity object (original and new resource), the JobActivityIdentity object, etc. Do I need to create a new Job ? if yes, do i have to get the jobId of the previous job ?
I finally found out a solution. I created a dll that allows me to create a new Job and delete previous job at a certain point of a workflow.
For this I used the JobIdentity CreateJobAndStartAt method. At this stage, it's rather easy to get the sessionId required because it's a system variable.
Basically, I implemented a method this way :
public class AppJobService
{
public JobIdentity CreateJobAndStartAt(string sessionId, string jobIdentityId)
{
JobIdentity returnValue = null;
var js = new sdk.JobService();
var pai = new ProcessActivityIdentity();
pai.ActivityName = Constants.activityName;
var pi = new ProcessIdentity();
pi.Name = Constants.processIdentityName;
try
{
returnValue = js.CreateJobAndStartAt(sessionId, pi, new JobInitialization(), pai);
// call terminate job
JobIdentity currentJi = new JobIdentity();
currentJi.Id = jobIdentityId;
TerminateJob(sessionId, currentJi);
}
catch (Exception ex)
{
throw;
}
return returnValue;
}
void TerminateJob(string sessionId, JobIdentity jobIdentity)
{
var js = new sdk.JobService();
try
{
js.TerminateJob(sessionId, jobIdentity);
}
catch (Exception ex)
{
throw;
}
}
}
This code works fine ! My questions are the following: