Skip to main content What is Dynamics 365? Guided tours Customer stories Try our products Build your own agents CRM ERP Sales Service Sales Customer Insights Customer Service Contact Center Field Service Supply Chain Management Commerce Finance Project Operations Human Resources Business Central Pricing Business application topics Training & certifications Migrate to the cloud Documentation Events Dynamics 365 Blog Product updates Onboarding and implementation Community Find a partner Software Development Companies Partner resources Microsoft Marketplace Product documentation Technical support On-premises product support Contact us Try for free Sign in

As described here Configuring the Lookup for a Data Set Field [AX 2012] you can change how lookup look like. What you can also do you can range to the lookup to show i.e. only rooms which are in service. Following X++ shows how to achieve this:

void dataSetLookup(SysDataSetLookup sysDataSetLookup)

{

List list = new List(Types::String);

Query query = new Query();

QueryBuildDataSource    queryBuildDataSource;

QueryBuildRange qbr;

 

// Add the table to the query.

queryBuildDataSource  = query.addDataSource(tableNum(FCMRooms));

 

// Specify the fields to use for the lookup.

list.addEnd(fieldStr(FCMRooms,RoomName));

list.addEnd(fieldStr(FCMRooms,RoomType));

list.addEnd(fieldStr(FCMRooms,InService));

 

 

// Supply the set of lookup fields.

sysDataSetLookup.parmLookupFields(list);

 

// Specify the field that is returned from the lookup.

sysDataSetLookup.parmSelectField(‘RoomName’);

 

//add the range

qbr = queryBuildDataSource.addRange( fieldnum(FCMRooms, InService));

qbr.value(NoYes::Yes);

//if we don’t want user to be able to change range we need to lock it

qbr.status(RangeStatus::Locked);

 

// Pass the query to the SysDataSetLookup so that the query is used.

sysDataSetLookup.parmQuery(query);

}

We need to lock the range in order user is unable to change the range. Otherwise if user in search will specify RoomName “Cubicle 8” (when inService == No) it will still appear because the range will be simply overwritten.

Get started with Dynamics 365

Drive more efficiency, reduce costs, and create a hyperconnected business that links people, data, and processes across your organization—enabling every team to quickly adapt and innovate.