Dialogue form through X++

Rumman Ansari   Software Engineer   2024-05-22 12:37:43   85  Share
Subject Syllabus DetailsSubject Details
☰ TContent
☰Fullscreen

Table of Content:

Sometimes, there is a requirement to implement the dialogue form and then use the values in some functionality. We can directly open the form with X++. Here’s how:

If we have a button on the form for example, and we need to open up a dialogue form, we can write the following code inside the clicked method of that button:

void clicked()


void clicked()
        {
            Dialog d;
            DialogField id;
            DialogField name;
            str   ReasonCategory , ReasonDetails;
            FormStringControl           control;
            FormBuildStringControl controll;
           
           
             super();
        
             d = new Dialog("Testing Dialog");
             category = d.addField(extendedtypestr(ReasonCodeEDT ), 'Inactivation Reason' );
             Details = d.addField(extendedTypeStr(TXT ), 'Category' )                ;



            if(d.run())
            {
               ReasonCategory  =       category.value();
               ReasonDetails   =       Details.value();
               // Implement business logic here
            }
        }

This will open up a new dialog form and implement any business logic too! Happy Learning.

MCQ Available

There are 5 MCQs available for this topic.

5 MCQ