Skip to main content

Notifications

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

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!

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 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
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 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
    @rp@n 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
    Mohit Rampal 12,554 Super User 2024 Season 1 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
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 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
    @rp@n 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
    Mohit Rampal 12,554 Super User 2024 Season 1 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
    @rp@n 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
    Anton Venter 19,493 Super User 2025 Season 1 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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,969 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,842 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans