web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Add lookup based on datasource with range

(0) ShareShare
ReportReport
Posted on by 209

Hi all,

I want to add value from my lookup StringEdit in a form.

I want to add the datasource of the form (it already has range/query)

How can i achieve that? here is my code, it works but has error: The form datasource query object does not support changing its AllowCrossCompany property after the form has executed the query.

It shows like the grid in datasource shows but Error occur when i click the dropdown multiple times. here is my code:

public void lookup()
{
    Query qry = CustTrans_ds.query();
    QueryBuildDataSource queryBuildDataSource;

    SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(CustTrans), this);

    sysTableLookup.addLookupField(fieldNum(CustTrans, Voucher));

    sysTableLookup.parmQuery(qry);

    sysTableLookup.performFormLookup();

    //super();
}


*This post is locked for comments

I have the same question (0)
  • XSpy Profile Picture
    209 on at

    This is AX 2012, sorry. Any input is appreciated. Thanks.

  • Verified answer
    Martin Dráb Profile Picture
    239,364 Most Valuable Professional on at

    Isn't it caused the fact that you're using the same query object? What if you make a copy?

    Query qry = new Query(CustTrans_ds.query());
  • XSpy Profile Picture
    209 on at

    Thank you Martin, it solved my issue.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 26

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans