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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

On Ok click button need info yes no Box using x++

(0) ShareShare
ReportReport
Posted on by 150

Hi,

I have to add an info box on the vendor Payment Proposal, before create Payment i need an info box where some static value show with selected invoices Amount (sum of specTrans.Balance01), on the click on Yes in the info box, payment will be created as per standard, but if we click on No button on the info box, it stays as same screen of Proposal.

Can anyone please suggest me that which blog i need to prefer and how can i solve it using x++ in D365fo?

I have the same question (0)
  • Verified answer
    GirishS Profile Picture
    27,827 Moderator on at

    Hi Sam,

    Refer to the below blog which might help your scenario.

    https://axchaitu.wordpress.com/2013/07/26/get-dialog-box-of-yes-or-no-for-any-operation-by-user-in-ax/

    Thanks,

    Girish S.

  • Sam D. Profile Picture
    150 on at

    Thank you, Girish, maybe it will be work, but how can I get sum of total amount for selected invoices and show it on the Info box.

    because I didn't get how can i show sum of selected invoices Amount on Box?

  • Verified answer
    GirishS Profile Picture
    27,827 Moderator on at

    Just try to pass the total amount to the 2nd parameter on the Box::yesNoCancel method.

    DialogButton     diagBut;  
    str amountvalue = int2str(25);//pass the total amount value
    create a label id like "Amount is %1"
    str strMessage = strfmt("LabeLid", amountValue); 
    str strTitle = "Title";
    diagBut = Box::yesNoCancel(
    strMessage,
    ialogButton::No,
    strTitle);
    if (diagBut == DialogButton::No)
    {
        info(“Operation stoped.”);
     }
    else if(diagBut == DialogButton::Yes)
    {  
    
        Info(“button click code here”);
    }
    else
    {     
    
    info(“canceled”);
     }

    Thanks,

    Girish S.

  • Sam D. Profile Picture
    150 on at

    Thank you, Girish,

    This code really helps me to create an info box.

    But I am facing an issue while click on "NO" in info box, It is also creating Payment Proposal instead cancel the Payment and stay at same screen.

        str                     strMsg = "The total amount to Pay" + any2Str(AmountVal);      

         dialogBtn  = Box::yesNo(strMsg, DialogButton::No);        

          if(dialogBtn == dialogButton::Yes)  

         {                 

        }    

        next clicked();    

        if(dialogBtn == dialogButton::Yes)    

        {         

       }              

          else   

        {          

        Info("Cancelled");      

       }         

    I need when click on "YES" , It will create Payment Proposal as standard, but when click on "NO" , It will cancel Payment Proposal and stay as same screen to edit amount.

    But , what is going on when we click on "NO" it is also creating Payment Proposal.

  • Verified answer
    GirishS Profile Picture
    27,827 Moderator on at

    I think restriction of payment proposal when clicking No button cannot be done with existing button.

    You need to hide the standard Payment proposal button and create one custom button - On the On Clicked event handler you add the same code as you have written above.

    If user clicks Yes go ahead and create payment proposal (Call the logic for payment proposal). If No throw a warning.

    Thanks,

    Girish S.

  • Sam D. Profile Picture
    150 on at

    Thank you Girish .

    Sam D.

  • GirishS Profile Picture
    27,827 Moderator on at

    Hope the issue is resolved. Please take time to mark the useful answers as verified. So, others can make use of this thread.

    Thanks,

    Girish S.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans