Skip to main content

Notifications

Announcements

No record found.

Supply chain | Supply Chain Management, Commerce
Suggested answer

All Prospect Lookup on Mode of Delivery

(1) ShareShare
ReportReport
Posted on by 1,883
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
  • Martin Dráb Profile Picture
    Martin Dráb 230,445 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
    faiz7049 1,883 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
    faiz7049 1,883 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
    Martin Dráb 230,445 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
    faiz7049 1,883 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
    Martin Dráb 230,445 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans