Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Why Array is showing null value?

Hi

I am using following code for Due date notification, but array is returning null

array.length is zero

//----


// create a duration of one hour

// IGPDuration duration = GPNotificationFactory.createDuration(1,14);

IGPDuration duration = GPNotificationFactory.createDuration(1, IGPDuration.DURATION_MINUTE);

//create a deadline with duration one hour (start date is current system time)

IGPDeadline deadline2 = GPNotificationFactory.createDeadline(

IGPDeadline.DEADLINE_FROM_ACTION_START, duration, System.currentTimeMillis(),0);

try

{

IGPRuntimeManager rtm = GPProcessFactory.getRuntimeManager();

Calendar cal = Calendar.getInstance();

java.sql.Date jsqlD = new java.sql.Date(cal.getTime().getTime());

IUser user = UMFactory.getUserFactory().getUserByLogonID("mrityunjay");

wdComponentAPI.getMessageManager().reportSuccess("user: "+user);

//String processId= executionContext.getProcessId();

//IWDClientUser wdUser = WDClientUser.getCurrentUser();

//IUser user =wdUser.getSAPUser();

IGPUserContext userContext = GPContextFactory.getContextManager().createUserContext(user);

wdComponentAPI.getMessageManager().reportSuccess("user: "+userContext);

IGPProcessInstanceInfo[] array = rtm.getRunningInstances(GPSearchRole.SEARCH_ROLE_OWNER,jsqlD , jsqlD,userContext);

wdComponentAPI.getMessageManager().reportSuccess("arraylength outside loop: "+array.length);

for (int i=0; i<array.length; i++)

{

wdComponentAPI.getMessageManager().reportSuccess("arraylength inside loop: "+array.length);

String instanceId = array<i>.getProcessInstanceID();

IGPProcessInstance instance = rtm.getProcessInstance(instanceId, userContext);

rtm.stopProcess(instance,userContext);

}

}//try

catch (Exception e)

{

//wdComponentAPI.getMessageManager().reportSuccess("exp in terminal: "+e);

}

/////////////////////////////////////////////////////////////////////////////////////////////

Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question