web
You’re offline. This is a read only version of the page.
close
Skip to main content
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)
  • Mohit Rampal Profile Picture
    12,563 Moderator on at
    RE: How to skip the code and add new code instead of this in standard method

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

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    RE: How to skip the code and add new code instead of this in standard method

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

  • @rp@n Profile Picture
    30 on at
    RE: How to skip the code and add new code instead of this in standard method

    Thanks Mohit,

    Shall I write the code before next method? 

  • Suggested answer
    Mohit Rampal Profile Picture
    12,563 Moderator on at
    RE: How to skip the code and add new code instead of this in standard method

    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/.../

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    RE: How to skip the code and add new code instead of this in standard method

    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.

  • @rp@n Profile Picture
    30 on at
    RE: How to skip the code and add new code instead of this in standard method

    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
    Mohit Rampal Profile Picture
    12,563 Moderator on at
    RE: How to skip the code and add new code instead of this in standard method

    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
    RE: How to skip the code and add new code instead of this in standard method

    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

  • Verified answer
    Anton Venter Profile Picture
    20,273 Super User 2025 Season 2 on at
    RE: How to skip the code and add new code instead of this in standard method

    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.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,352

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 616 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans