Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

how to add method to dataField in form extension?

(1) ShareShare
ReportReport
Posted on by 920

Hello,

I add create extension of form EcoResProductLifecycleState

I add new datasource , then I want to add lookup method to dataField of this dataSource : 

pastedimage1682583181131v1.png

have you any idea?

  • BASMA Profile Picture
    BASMA 920 on at
    RE: how to add method to dataField in form extension?

    I try to debug the standard code  (the class ITMCreatorSetup method performLookupField) but the method doesn't gets  hit

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: how to add method to dataField in form extension?

    Can you tell me what will be the value for "FilterStr" buffer?

    Thanks,

    Girish S.

  • BASMA Profile Picture
    BASMA 920 on at
    RE: how to add method to dataField in form extension?

    I can't debug it , the Method COC doesn't gets hit

    but when I added the on_lookup eventhandler , I can debug it and I get the list of table in the first lookup

    [FormControlEventHandler(formControlStr(EcoResProductLifecycleState, MandatoryFieldsTable_TableLabel), FormControlEventType::Lookup)]
        public static void MandatoryFieldsTable_TableLabel_OnLookup(FormControl sender, FormControlEventArgs e)
        {
             MandatoryFieldsCheck   mandatoryFieldsCheck;
             MandatoryFieldsTable  mandatoryFieldsTable;
            FormStringControl  tableLabel = sender as FormStringControl ;
            mandatoryFieldsCheck = MandatoryFieldsCheck::construct();
            mandatoryFieldsCheck.performLookupTable(tableLabel, mandatoryFieldsTable);
        }

    But I cant get the list of fields of the selected table in the second lookup due to the paramter "FilterStr"

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: how to add method to dataField in form extension?

    Okay, have you debugged the code and does the lookup method COC gets hit?

    Form the screenshot you pasted in the previous reply I can be able to see the lookup button.

    Can you elaborate that?

    Thanks,

    Girish S.

  • BASMA Profile Picture
    BASMA 920 on at
    RE: how to add method to dataField in form extension?

    I tried to add the same logic of this form : 

    pastedimage1682601926828v1.png

    so I add new class to add the some logic of ITMCreatorSetup

    new form like  : ITMCreatorSetupFieldLookup

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: how to add method to dataField in form extension?

    Hi BASMA,

    On the Lookup argument "_filterStr" what values you are getting. I have testing this, and I am getting empty string (" ") value.

    What are you using for this?

    Can you elaborate?

    Thanks,

    Girish S.

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: how to add method to dataField in form extension?

    Have you debugged the code does the debugger gets hit?

    Thanks,

    Girish S.

  • BASMA Profile Picture
    BASMA 920 on at
    RE: how to add method to dataField in form extension?

    yes lookup is not working, i don't get th list of tables that I add it in this class :

    ...

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: how to add method to dataField in form extension?

    Your question is not clear. Are you saying that lookup is not working?

    Can you elaborate more?

    Thanks,

    Girish S.

  • BASMA Profile Picture
    BASMA 920 on at
    RE: how to add method to dataField in form extension?

    hi

    I add this code : 

    [ExtensionOf(formDataFieldStr(EcoResProductLifecycleState, MandatoryFieldsTable, FieldLabel))]
     final class EcoResProductLifeCycleState_FieldLabel_Extension
    {
        public  MandatoryFieldsCheck   mandatoryFieldsCheck;
        public MandatoryFieldsTable  mandatoryFieldsTable;
    
        public void lookup(FormControl _formControl, str _filterStr)
        {
            next lookup(_formControl,_filterStr);
            mandatoryFieldsCheck = MandatoryFieldsCheck::construct();
            mandatoryFieldsCheck.performLookupField(_formControl, mandatoryFieldsTable, _filterStr);
        }
    
        public boolean validate()
        {
            boolean ret;  
            next validate();
            mandatoryFieldsCheck = MandatoryFieldsCheck::construct();
            //ret = super();
            ret = ret && mandatoryFieldsCheck.validateField(mandatoryFieldsTable);
            return ret;
        }
    
    }

    but doesn't work  : 

    pastedimage1682595012262v1.png

    have you any example that has the same structure of this 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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,160 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans