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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Lookup Fixed Asset in Purchase Order Ax 2012

(0) ShareShare
ReportReport
Posted on by

Hi experts,

Im making lookup for asset number because the standard setting for asset number cannot do any filter while the user need the asset number can be filter.

0181.1.png

Above is the standard lookup for the asset number in purchase order.

Here is the picture after Im doing the custom

7532.2.png

The lookup can be filter, below is the code I made to do the lookup

public void lookup()
{
    //AssetTable::lookupInvoiceAsset(this, curext());
    SysTableLookup          sysTableLookup  = SysTableLookup::newParameters(tablenum(AssetTable), this);
    Query                   query           = new Query();
    QueryBuildDataSource    queryBuildDataSource;
    QueryBuildRange         queryBuildRange;
    ;
    sysTableLookup.addLookupfield(fieldnum(AssetTable, AssetGroup));
    sysTableLookup.addLookupfield(fieldnum(AssetTable, AssetId));
    sysTableLookup.addLookupfield(fieldnum(AssetTable, Name));

   //BP deviation documented
    queryBuildDataSource = query.addDataSource(tablenum(AssetTable));
    queryBuildRange = queryBuildDataSource.addRange(fieldnum(AssetTable, AssetId));
    //queryBuildRange.value(Global::queryNotValue(TableName.fieldname));

    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}


But after Im choosing one item there is an warning. Below is the warning info log

41131.3.png

What should I check first when the warning is showing up?
I already check some method that contain "Asset" word in the form but there is none that explain about the table Fixed Assets.
Can some one tell me what should I check to repair the warning?
Your help mean a lot to me

Thanks and Regards,
Enggar

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Mea_ Profile Picture
    60,284 on at
    RE: Lookup Fixed Asset in Purchase Order Ax 2012

    Hi Putri Enggar Ningrum Ika Pamulat,

    You getting this error because your lookup selects Asset group, not Asset id. To fix it you need to change code from

    sysTableLookup.addLookupfield(fieldnum(AssetTable, AssetId));

    to

    sysTableLookup.addLookupfield(fieldnum(AssetTable, AssetId), true);
  • Community Member Profile Picture
    on at
    RE: Lookup Fixed Asset in Purchase Order Ax 2012

    Hello ievgen,

    Yes you are right, I need to change my code.

    Thanks for your help, now the lookup run smootly

    Thanks and regards,

    Enggar

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
Community Member Profile Picture

Community Member 2

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans