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

How to skip the code and add new code instead of this in standard method

(0) ShareShare
ReportReport
Posted on by 30

Hi All,

pastedimage1683654409206v1.png

In the button SalesInvoiceDuplicateOriginal, the if condition () , I like to modify the code for if only

Kindly let me know how I can achieve this? So, that my custome code for If will run and the existing if code will skip

Pls give me more shed on this.

thanks!

I have the same question (0)
  • Verified answer
    Anton Venter Profile Picture
    20,346 Super User 2025 Season 2 on at

    Create an extension of the form. Add your own button to the form with the same label and add code that you want. Set the visible property of the original button to false.

  • @rp@n Profile Picture
    30 on at

    Thanks Anton

    You mean to say in for the form CustInvoiceDuplicateTable_W,  I need to create an extension and

    Then need to add a new button with same label like SalesInvoiceDuplicateOriginal.

    Am I correct?

    If correct, then let me know what to do next?

    Pls give me more shed on this

  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi, In this scenario, you can't bypass standard logic. As Anton suggested, you can duplicate this button, hide original button and change the code in clicked method of duplicated button. So user can see only your button and your custom code will be executed.

  • @rp@n Profile Picture
    30 on at

    Thanks Mohit and Anton

    Let's clarify one things

    Suppose I have create an extension class for that duplicate button. And before next I need to  write the code.

    My question is

    Here it will first executed my custom code and then executed next SalesInvoiceDuplicateOriginal

    Once it come to next then it will again executed the if condition correct?

    That I dont want to executed.

    I like to run my custom code only instead of this.

    2. In the above pic, it is getting the value from args to get the current record value correct?

    In my  custom code , I mean in extension class how to call this args value there?

    Please give me more shed on this

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at

    As suggested by Anton and Mohit, requirement can be achieved in the said way.

    For your question, you cannot skip the standard. Because if there is only if, we can simply make the buffer empty so if can be skipped and again it goes to else. So we cannot or it is not possible here to skip the code. You can proceed by the suggestions of Anton and Mohit.

  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    We are saying to duplicate the form control, create extension class for form control. Create CoC on clicked method, use exact same code and just replace super() with next Clicked(). Make changes in the if condition. hide the standard form control (button).

    When you do this, it will not call standard code that you have in screenshot.

    dynamics365musings.com/.../

  • @rp@n Profile Picture
    30 on at

    Thanks Mohit,

    Shall I write the code before next method? 

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at

    Yes, you can write the code before next().

  • Mohit Rampal Profile Picture
    12,565 Moderator on at

    Yes please, call to next is same as call to super. So write before next statement.

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
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 422 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans