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 :
Supply chain | Supply Chain Management, Commerce
Suggested answer

All Prospect Lookup on Mode of Delivery

(1) ShareShare
ReportReport
Posted on by 2,382
Hi Experts,
 
I want to override the Mode of delivery lookup on Prospects. The Form Name is DirPartyQuickCreateForm and Control is DynamicsDetails. But in DynamicsDetails I did not find anything.
 
Please help me how can I override the lookup on Mode of delivery.
 
 
 
 
 
Thanks,
Faiz
I have the same question (0)
  • Martin Dráb Profile Picture
    236,204 Most Valuable Professional on at
    All Prospect Lookup on Mode of Delivery
    The data source field doesn't exist in AOT, but it does exist at runtime. Your own screenshot shows that the form control is bound to this data source field:
     

    You just need to find the right place where to get the generated datasource field.
  • faiz7049 Profile Picture
    2,382 on at
    All Prospect Lookup on Mode of Delivery
    Hi Martin,
     
    Thank you. It's working with below code.
    [ExtensionOf(formStr(DirPartyQuickCreateForm))]
    final public class SFA_DirPartyQuickCreateForm_DlvMode_Extension
    {
    
            public void init()
    
    
        {
            
            next init();
         if(fbds.table() == tableNum(smmBusRelTable))
    
           {
    
             //   dirPartyEntityDataSource    = _formRun.dataSource(formDataSourceStr(DirPartyQuickCreateForm, DirPartyEntity)) as FormDataSource;
             dirPartyEntity_ds.object(fieldNum(smmBusRelTable,DlvMode)).registerOverrideMethod(methodStr(FormDataObject, lookup), methodStr(SFA_DirPartyQuickCreateForm_DlvMode_Extension, myLookupMethod), this);
           }
    
        }
    
    
       public void myLookupMethod(FormStringControl _fsc)
        {
            SysTableLookup tableLookup = SysTableLookup::newParameters(tableNum(SFA_SalesAgreementDlvMode),_fsc);
    
           
          tableLookup.addLookupField(fieldNum(SFA_SalesAgreementDlvMode,Name));
          tableLookup.addLookupField(fieldNum(SFA_SalesAgreementDlvMode,Description));
    
            tableLookup.performFormLookup();
           
        }
    
    }
     
  • faiz7049 Profile Picture
    2,382 on at
    All Prospect Lookup on Mode of Delivery
    Hi Martin,
     
    But DirPartyEntity on form DirPartyQuickCreateForm does not have field DlvMode. How to override it.
     
    Thanks,
    Faiz
  • Martin Dráb Profile Picture
    236,204 Most Valuable Professional on at
    All Prospect Lookup on Mode of Delivery
    The error message is clear: you're trying to call fieldId() method, but no such a method exists, therefore your code can't even compile.
    Didn't you mean dirPartyEntity_ds.object()?
  • faiz7049 Profile Picture
    2,382 on at
    All Prospect Lookup on Mode of Delivery
    Hi Martin,
     
    Could you see help me I am getting error "The FormBuildDataSource does not contain the definition of method fieldId.
     
    fbds.fieldId(fieldNum(smmBusRelTable,DlvMode))
     
    [ExtensionOf(formStr(DirPartyQuickCreateForm))]
    final public class SFA_DirPartyQuickCreateForm_DlvMode_Extension
    {
    
        public void init()
    
    
        {
            
            next init();
           if(fbds.table() == tableNum(smmBusRelTable))
    
            {
    
            
               fbds.fieldId(fieldNum(smmBusRelTable,DlvMode)).registerOverrideMethod(methodStr(FormDataSource, lookup), methodStr(SFA_DirPartyQuickCreateForm_DlvMode_Extension, myLookupMethod), this);
            }
    
        }
    
    
        public void myLookupMethod(FormStringControl _fsc)
        {
            SysTableLookup tableLookup = SysTableLookup::newParameters(tableNum(SFA_SalesAgreementDlvMode),_fsc);
    
           
            tableLookup.addLookupField(fieldNum(SFA_SalesAgreementDlvMode,Name));
            tableLookup.addLookupField(fieldNum(SFA_SalesAgreementDlvMode,Description));
    
            tableLookup.performFormLookup();
           
        }
        
    }
    Thanks,
    Faiz
  • Suggested answer
    Martin Dráb Profile Picture
    236,204 Most Valuable Professional on at
    All Prospect Lookup on Mode of Delivery
    If you want to know how fields get into DynamicsDetails group, open addDynamicControls() method. You'll see that the group on the form is bound to quickCreateDetails group on the table that the form was called for (smmBusRelTable in your case).
     
    What you could do, maybe, is checking whether fbds.table() == tableNum(smmBusRelTable) (because there are other parties using the same form) and registering an override of lookup() of the data source field. That would be done when initializing the form.

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 > Supply chain | Supply Chain Management, Commerce

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 1,098

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 305 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 215 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans