Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance forum
Unanswered

dialog class

(1) ShareShare
ReportReport
Posted on by
Hi,

I want a dialog that has three radio buttons
  • option1
  • option2
  • option3 and if we tick option 3 next to it (to the right) a text control should appear
how to do option3 with a str control next to it?

The dialog shouldn't be a form, just using the dialog class
  • Anton Venter Profile Picture
    20,120 Super User 2025 Season 1 on at
    dialog class
    1. You want to separate your logic from the user interface.  This makes the code more reusable and the code can be used without being forced to load the form. E.g. batch processes are ujnable interact with the user interface.
    2. Short answer, enums are the way to go. There are other ways but then you will have to get creative.
    3. I did a quick test and realised that this is tricky because of the vertical alignment of the controls.
  • Anton Venter Profile Picture
    20,120 Super User 2025 Season 1 on at
    dialog class
    You have to create the form during 'runtime' using the classfactory like in the prompt method below. The code below is an example of using your own form as a dialog and may need some adjustments besides changing the form name to your own form name and adding logic to the run method. I have not tested the code example below yet but I have used this pattern many before for small simple operations.
     
    You need an enum for the values but you can change the way it's displayed on the form.

    Add a form group control to the form and then add the two controls to the form group control.
     
    public final class MyCustomRunnableClassWithCustomFormAsDialog
    {	
    	private FormRun mFormRun;
    
    	public void run()
    	{
    		// Add logic here.
    	}
    
    	public boolean prompt()
    	{
    		Object obj;
    
    		mFormRun = classFactory.formRunClass(new Args(formStr(MyCustomFormDialog))); // Change form name.
    		mFormRun.init();
    		mFormRun.run();
    		mFormRun.wait();
    
    		if (mFormRun.closedOk()) // Did the user click OK?
    		{
    			obj = mFormRun;
    			// Retrieve form values set class variable here.
    		}
    
    		return mFormRun.closedOk();
    	}
    
    	public static void main(Args _args)
    	{
    		MyCustomRunnableClassWithCustomFormAsDialog operation = new MyCustomRunnableClassWithCustomFormAsDialog();
    
    		if (operation.prompt())
    		{
    			operation.run();
    		}
    	}	
    }
     
  • Anton Venter Profile Picture
    20,120 Super User 2025 Season 1 on at
    dialog class
    Correct, you could just use your form as a dialog. I've done this before and it also works. You have to create your form during runtime though,
  • Waed Ayyad Profile Picture
    8,673 Super User 2025 Season 1 on at
    dialog class
    Hi,
     
    You can use Sys Operation framework to implement your requirements, check the following link, it maybe helps you:
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
  • Anton Venter Profile Picture
    20,120 Super User 2025 Season 1 on at
    dialog class
    Hello,
     
    With the SysOperation framework, you can create a custom dialog (with the text field to the right of the option control) and specify to use your custom dialog by overriding the SysOperationController.templateForm() override method.
     
     
  • Anton Venter Profile Picture
    20,120 Super User 2025 Season 1 on at
    dialog class
    Hello,
     
    I recommend using the SysOperation framework and a UIBuilder class. With your own UIBuilder class, you can show and hide the text field when a certain value in another field (option / enum) is selected. Have a look at some SysOperation framework examples and also some examples with a UIBuilder class (extending from SysOperationAutomaticUIBuilder).

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

Featured topics

Product updates

Dynamics 365 release plans