Post

1 follower Follow
0
Avatar

how recovered the predecessors of a task?

I have tried using the DependecyLink, but returns null.

String[] fields={"DependsOn","Lag"}

EntityQuery qry = new EntityQuery();

qry.setTypeName("DependecyLink");

qry.setFields(Fields);

QueryResult qr = user.query(qry);

ivan Lopez Answered

Please sign in to leave a comment.

2 comments

0
Avatar

Hi,

 

My name is Yaron Perlman and I am with the professional services team. I will need the complete code and perhaps the stack trace you are getting to try and reproduce this on our end and advise.

Looking forward to help on this!

 

Yaron.

Yaron Perlman 0 votes
Comment actions Permalink
0
Avatar

This is the code:

 

FieldExpression lef = new FieldExpression("DependsOn");

ConstantExpression right= new ConstantExpression();

EntityId value = new EntityId();

value.setTypeName("WorkItem");

value.setValue("a5fe9094951b4e21a3aa048c4608b240");

RightExpression.setValue(value);

/////

int RegistrosTask = 0;

int Cont = 0;

EntityQuery qry = new EntityQuery();

qry.setTypeName(setTypename);

Compare condicion = new Compare();

condicion.setLeftExpression(left);

condicion.setOperator(Operator.Equal);

condicion.setRightExpression(right);

qry.setWhere(condicion);

qry.setFields(Fields);

 

QueryResult qr = user.query(qry);

System.out.println("QueryCompare");

if(qr.isSuccess())

{

do

{

System.out.println("numero de datos"+ qr.getPaging().getPageNumber());

System.out.println("numero de datos"+ qr.getPaging().getHasMore());

System.out.println("numero de datos"+ qr.getPaging().getPageSize());

List<EntityId> workItemIds = new ArrayList<EntityId>();

BaseEntity lista[] = qr.getEntities();

System.out.println(lista.length);

RegistrosTask = RegistrosTask + lista.length;

for (int z=0;z<lista.length;z++){
workItemIds.add(lista[z].getId());
GenericEntity dato = (GenericEntity) lista[z];
System.out.println("--->"+lista[z].getId().getTypeName()+"/InternalId " +lista[z].getId().getValue());

//for(int y = 0;y< dato.getValues().length;y++)

System.out.println("--->///"+dato.getValues()[0].getValue().toString());

System.out.println("salte lo if");

}

System.out.println("");

Cont++;

}while( Cont < 1);

System.out.println("Numero de Dependencias en el workitem: "+ RegistrosTask);

}

else

{

System.out.println("error QueryCompare "+ qr.getError().getMessage());

}

attempt to recover, the dependencies of a workitem through the workitem id.

in the attached image you can see the result with the client they provide. I would expect the same result with my query.

 

Thanks.

ivan Lopez 0 votes
Comment actions Permalink