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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / How to modify a dialog...
Finance forum

How to modify a dialog field value at run time

(0) ShareShare
ReportReport
Posted on by 145

Hello friends,

I have a scenario where I have to modify a dialog form by adding my new fields in D365O.

The standard class is extended with runbasebatch class.

I have used Chain Of Command method to create extension of this standard class and to add my four dialog fields.

Now my second requirement is that, based on one of my custom field's value the standard dialog field value will be enabled or disabled.

I have tried the approach explained in the below links, but no luck:

http://dynamicsaxforum.blogspot.com/2012/10/override-event-methods-on-dialog.html

https://community.dynamics.com/ax/b/axworld/archive/2018/01/19/ax2012-dynamic-actions-on-runbase-dialog

This may be working in Ax 2012, but not working in D365O in my case.

Had anyone gone through this requirement in D365O before?

Any suggestions will be helpful.

Best Regards

Pranav

I have the same question (0)
  • Martin Dráb Profile Picture
    238,836 Most Valuable Professional on at

    Can you please explain your problem with registerOverrideMethod()? Saying "it's not working" isn't very detailed.
    Speaking of RunBase, don't forget to check out Creating extensions > Extend the RunBase class in F&O documentation.

  • Pranav Gupta Profile Picture
    145 on at
    
    

    Hi Martin,

    I have written the below code in my dialog() in the Chain of command class.

    tempCustIdQueryCtrl = dialogPickWorkBenchCustId.fieldControl();
            
    tempCustIdQueryCtrl.registerOverrideMethod(methodStr(FormStringControl, modified), methodStr(MCRPickingWorkBenchBatch_InventPickWorkBench_Extension, modifiedCustId), dialogRunbase);

    where 

    tempCustIdQueryCtrl is a FormBuildStringControl.


    but while debugging the class, my new method i.e. "modifiedCustId" is not getting called.

    I did a full build also, but still my method is not getting called.

    Best Regards

    Pranav

  • Suggested answer
    Sukrut Parab Profile Picture
    71,716 Moderator on at

    I think MCRPickingWorkBenchBatch_InventPickWorkBench_Extension is extension  of MCRPickingWorkBenchBatch class . You have added method  to modifiedCustId  to class MCRPickingWorkBenchBatch, as you are augmenting base class  . Can you try passing that as a class name instead of MCRPickingWorkBenchBatch_InventPickWorkBench_Extension to methodstr function.

  • Pranav Gupta Profile Picture
    145 on at

    Hi Sukrat,

    I tried with that also, but still not getting called.

  • Martin Dráb Profile Picture
    238,836 Most Valuable Professional on at
    Does modifiedCustId() has the right signature? Is dialogRunbase the right object?
    Here is a simple example that you can copy and run:
    class DialogMethodOverrideDemo extends RunBase
    {    
        public static void main(Args _args)
        {      
            DialogMethodOverrideDemo demo = new DialogMethodOverrideDemo();
            demo.prompt();
        }
    
        public Object dialog()
        {
            Dialog dialog = super();
    
            DialogField tempCustIdQueryCtrl = dialog.addField(extendedTypeStr(CustAccount));
            tempCustIdQueryCtrl.registerOverrideMethod(methodStr(FormStringControl, modified), methodStr(DialogMethodOverrideDemo, modifiedCustId), this);
    
            return dialog;
        }
    
        public boolean modifiedCustId(FormStringControl _control)
        {
            info("It works");
            return true;
        }
    }

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans