Blog Archive

Friday, June 16, 2023

D365 FO - Creating a custom Lookup Field

 

Creating a lookup on Field

 Here is a simple way of creating lookup field.

[Control("String")]

    class SLDApprelPricingReq_CustomerId

    {

        /// <summary>

        ///

        /// </summary>

        public void lookup()

        {

 

            //Specify the name of the table the lookup should show data from.

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

            //Create a new query

            Query                   query = new Query();

            QueryBuildDataSource    queryBuildDataSource;

            QueryBuildRange         queryBuildRange;

 

            //Specify the name of the table the lookup should show data from.

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

            //Specify which fields should be shown  in the lookup form.

            //  field returned is the first field referenced

            sysTableLookup.addLookupfield(fieldNum(CustTable, AccountNum));

 

            sysTableLookup.parmQuery(query);

            sysTableLookup.performFormLookup();

 

        }

No comments:

Post a Comment

Adding Postal Address of HCMApplicant

 Hi, If you want to add a postal address in D365 FnO against party. or DirPartyTable. My use case was while creating a HCMApplicant we need ...