Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Answered

Is it possible to change the order when create SysTableLookup?

(0) ShareShare
ReportReport
Posted on by

I am trying to overwrite the lookup() method of a string field on a datasource.

Here is the code

SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(PurchLine), _lookupCtrl);

Query query = new Query();
QueryBuildDataSource queryBuildDataSourceLine = query.addDataSource(tableNum(PurchLine));
queryBuildDataSourceLine.addRange(fieldNum(PurchLine, isDeleted)).value(queryValue(NoYes::No));
sysTableLookup.parmQuery(query);

sysTableLookup.addLookupfield(fieldNum(PurchLine, PurchId));
sysTableLookup.addLookupfield(fieldNum(PurchLine, InventTransId), true);
sysTableLookup.addLookupfield(fieldNum(PurchLine, ItemId));

sysTableLookup.performFormLookup();

Hopefully, I want to make the order of columns is: purchId -> InventTransId -> ItemId, this is the default order if calling super() method.

But actually, the order is: InventTransId -> PurchId -> ItemId.

Seems like it put the returnItem to the first place by default.

So my question is that is it possible to change the order when create SysTableLookup?

Or I should create a lookup form instead of using SysTableLookup?

  • Suggested answer
    Kai Cheng Profile Picture
    on at
    Is it possible to change the order when create SysTableLookup?
    Finally, I have to create a new form to follow the original format of dialog. 
  • Suggested answer
    Mohit Rampal Profile Picture
    12,556 Moderator on at
    RE: Is it possible to change the order when create SysTableLookup?

    Hi Kai, I think its because you have set returnItem parameter true for InventTransId. Try removing True Parameter. If you want to return InventTransId but need that field sequence then you can try creating lookup form.

    sysTableLookup.addLookupfield(fieldNum(PurchLine, InventTransId), true);

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,884 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,748 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans