Dear Friends ,
I have a very simple 2 step workflow (initiate and approve)Using Java API's I initiate this workflow and now i would like to dynamically assign the approver also i would like to add some comments which will be passed to next step. i have attached my code with this message.
i am able to reassign task using reassignTask() method,
but i want to change the comments and attributes.
any help is will be usefull. I think i am missing doing some silly mistake.
Please help.
Thank You in advance for any help.
Dilip.
import com.opentext.api.*;
public class WorkFlowSample
{
private static String Server = "localhost"; //livelink host
private static int Port = 2099; //livelink server port see opentext.ini
private static String DFT = ""; //default database file or schema
private static String User = "Admin"; //username
private static String Pass = "livelink"; //passwd
public static void main(String[] args)
{
try
{
LLSession session;
LAPI_DOCUMENTS doc;//library object
LAPI_WORKFLOW flow;//workflow object
LLValue value=new LLValue();
int workFlowStatus = 0 ;
session = new LLSession (Server, Port, DFT, User, Pass);
doc = new LAPI_DOCUMENTS (session);
flow = new LAPI_WORKFLOW (session);
LLValue LLvalueWP=new LLValue();
int volID, objID,versionID;
if (doc.AccessEnterpriseWS(value) == 0)
{
objID = value.toInteger("ID");
volID = value.toInteger("VolumeID");
LLValue map = ( new LLValue() ).setRecord();
//20646 is a Workflow id
workFlowStatus = flow.LoadMap(-2000,20646,0,map);
LLValue workIDValue = ( new LLValue() );
LLValue lAdditions = (new LLValue()).setList();
//lAdditions.add(5494); // this is a document ID
flow.StartWorkflow(map,"Sample Workflow .... ",null,workIDValue);
int liWorkID = workIDValue.toInteger();
// updating work Package
LLValue workPackageID = ( new LLValue() );
LLValue lWorkPackage = (new LLValue()).setRecord();
flow.AccessWorkPackage(liWorkID,liWorkID,lWorkPackage);
for (int i=0 ; i < lWorkPackage.size() ; i++)
{
LLValue lRecord = lWorkPackage.toValue(i);
if (lRecord.isRecord())
{
if (1 == lRecord.toInteger("SUBTYPE"))
{
//5494 is document ID
lRecord.setInteger("USERDATA",5494);
}
if (2 == lRecord.toInteger("SUBTYPE"))
{
lRecord.setString("USERDATA"," This is my new Comment... ");
}
}
}
flow.UpdateWorkPackage(liWorkID,liWorkID,lWorkPackage);
//flow.UpdateTaskWork(liWorkID,liWorkID,1,lWorkPackage);
//flow.StartTask(liWorkID,liWorkID,1,lWorkPackage);
System.out.println(" Done ...");
}
}
catch (Exception e)
{
System.out.println(e.getMessage() );
e.printStackTrace ();
}
}
}
I have a very simple 2 step workflow (initiate and approve)Using Java API's I initiate this workflow and now i would like to dynamically assign the approver also i would like to add some comments which will be passed to next step. i have attached my code with this message.
i am able to reassign task using reassignTask() method,
but i want to change the comments and attributes.
any help is will be usefull. I think i am missing doing some silly mistake.
Please help.
Thank You in advance for any help.
Dilip.
import com.opentext.api.*;
public class WorkFlowSample
{
private static String Server = "localhost"; //livelink host
private static int Port = 2099; //livelink server port see opentext.ini
private static String DFT = ""; //default database file or schema
private static String User = "Admin"; //username
private static String Pass = "livelink"; //passwd
public static void main(String[] args)
{
try
{
LLSession session;
LAPI_DOCUMENTS doc;//library object
LAPI_WORKFLOW flow;//workflow object
LLValue value=new LLValue();
int workFlowStatus = 0 ;
session = new LLSession (Server, Port, DFT, User, Pass);
doc = new LAPI_DOCUMENTS (session);
flow = new LAPI_WORKFLOW (session);
LLValue LLvalueWP=new LLValue();
int volID, objID,versionID;
if (doc.AccessEnterpriseWS(value) == 0)
{
objID = value.toInteger("ID");
volID = value.toInteger("VolumeID");
LLValue map = ( new LLValue() ).setRecord();
//20646 is a Workflow id
workFlowStatus = flow.LoadMap(-2000,20646,0,map);
LLValue workIDValue = ( new LLValue() );
LLValue lAdditions = (new LLValue()).setList();
//lAdditions.add(5494); // this is a document ID
flow.StartWorkflow(map,"Sample Workflow .... ",null,workIDValue);
int liWorkID = workIDValue.toInteger();
// updating work Package
LLValue workPackageID = ( new LLValue() );
LLValue lWorkPackage = (new LLValue()).setRecord();
flow.AccessWorkPackage(liWorkID,liWorkID,lWorkPackage);
for (int i=0 ; i < lWorkPackage.size() ; i++)
{
LLValue lRecord = lWorkPackage.toValue(i);
if (lRecord.isRecord())
{
if (1 == lRecord.toInteger("SUBTYPE"))
{
//5494 is document ID
lRecord.setInteger("USERDATA",5494);
}
if (2 == lRecord.toInteger("SUBTYPE"))
{
lRecord.setString("USERDATA"," This is my new Comment... ");
}
}
}
flow.UpdateWorkPackage(liWorkID,liWorkID,lWorkPackage);
//flow.UpdateTaskWork(liWorkID,liWorkID,1,lWorkPackage);
//flow.StartTask(liWorkID,liWorkID,1,lWorkPackage);
System.out.println(" Done ...");
}
}
catch (Exception e)
{
System.out.println(e.getMessage() );
e.printStackTrace ();
}
}
}