Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

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

(0) ShareShare
ReportReport
Posted on by 140

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?

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: On Ok click button need info yes no Box using x++

    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.

  • Sam D. Profile Picture
    Sam D. 140 on at
    RE: On Ok click button need info yes no Box using x++

    Thank you Girish .

    Sam D.

  • Verified answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: On Ok click button need info yes no Box using x++

    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
    Sam D. 140 on at
    RE: On Ok click button need info yes no Box using x++

    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
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: On Ok click button need info yes no Box using x++

    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
    Sam D. 140 on at
    RE: On Ok click button need info yes no Box using x++

    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
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: On Ok click button need info yes no Box using x++in d365fo

    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.

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... 291,996 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,853 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans