Aif query error


I’m getting this error while processing a message in the queue manager (own translation):

“CustCollectionLetterTrans is not the rootelement of the query. You may not set criteria on a datasource without any root.”

I am using the standard AxdCustCollectionLetter query. I have also tried making a new query changing the order of the query but I get the same result, but now another datasource is indicated to not have any rootelement.

I am using the “SendByQuery” option and the query I’m sending is containg a range of recIds in CustCollectionLetterJour.

Does anybody have any suggestion to what I’m doing wrong.


can you share me your code to check the issue.


The query used is standard AxdCustCollectionLetterJour. And this is the code I put into the “SendElectronically” method. _collectionRecIdSet is a Set of recIds.

AIFSendActionType sendActionType = AifSendActionType::SendByQuery;

AifConstraint aifConstraint = new AifConstraint() ;

AifConstraintList aifConstraintList = new AifConstraintList();

AifActionId aifactionId;

AifEndpointList endpointList;

Query query;

QueryBuildDataSource custCollectionLetter_ds;

QueryBuildRange recIdRange;

SetEnumerator setEnum;

Str rangeStr;

query = new Query(queryStr(AxdCustCollectionLetter));

custCollectionLetter_ds = query.dataSourceTable(tablenum(CustCollectionLetterJour));

recIdRange = custCollectionLetter_ds.addRange(fieldNum(CustCollectionLetterJour, RecId));

if (_collectionRecIdSet.elements())


setEnum = _collectionRecIdSet.getEnumerator();

while (setEnum.moveNext())


rangeStr += int2str(setEnum.current()) + ‘,’;




return false;


aifActionId = AifSendService::getDefaultSendAction(classnum(CustCollectionLetterService), sendActionType);



endPointList = AifSendService::getEligibleEndpoints(aifActionId, aifConstraintList);

AifSendService::submitFromQuery(aifActionId, endPointList,query,AifSendMode::Async);