Expression Builder Lookup using X++

I was just wondering if there is any way of popping a lookup form during the program execution.

We have seen many ways of creating lookups – EDT’s, relations, AutoLookup and through custom code [SysTableLookup]

Let us consider an example: I have a select query whose behaviour should be dynamic based on the User input. We might have used query Framework classes many a times to do this.

I was just going through the standard classes and found this code useful with minimum tweaking of code.

Try out the below example: This example will help you to select the custAccount and based on the selected customer account it brings you the last invoiced sales order.

Note: The columns in the form are built runtime using the AutoLookup fields.

static void SR_expressionBuilderLookUp(Args _args)
CustTable custTable;
ExtendedDataTypeName extendedDataType = extendedtypestr(custAccount);
CustAccount custAccount;

Object expressionBuilderLookup;
Args args = new Args(formstr(SysExpressionBuilderLookup));

expressionBuilderLookup = new FormRun(args);


custAccount = expressionBuilderLookup.parmSelectedValue();

info(strfmt(‘Last SO of customer %1 is %2’, custAccount, CustTable::find(custAccount).lastInvoice().SalesId));

Below is the lookup image for your reference


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s