Lookup at runtime in Enterprise portal web form MSD ax 4.0

Lookup at runtime in Enterprise portal web form ax 4.0


 webTableLookup webTableLookup;  
 Query query;  
 QueryBuildDataSource qbds;  
 WebSession webSession = new WebSession();  
 ;  
 query = new Query();  
 qbds = query.addDataSource(tablenum(testTable));  
 qbds.addSortField(fieldnum(testTable,colm1));  
 qbds.orderMode(orderMode::GroupBy);  
 webTableLookup = webTableLookup::newParameters(tablenum(testTable));  
 webTableLookup.addLookupfield(fieldnum(testTable,colm1));  
 webTableLookup.selectField (fieldnum(testTable,colm1));  
 webTableLookup.parmQuery(query);  
 webTableLookup.run();  
I hope this can help you a lot.