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 :
Dynamics 365 Community / Forums / Finance forum / Override Table Methods...
Finance forum

Override Table Methods in D365

(0) ShareShare
ReportReport
Posted on by

Hello,

How can I override the implementation of a table method in an Extension class?

I am developing a custom Workflow for Sales Order, for that i need to override *CanSubmitToWorkflow* method in table. For now, according to my understanding this can only be achieved by Overlayering which definitely is not a good practice. Can someone here guide me if there is any workaround?

I have the same question (0)
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    301,037 Super User 2025 Season 2 on at

    Hi Hafiz,

    I haven't checked it in D365 yet, but I thought you need to create the method which would be possible in an extension. There is out of the box no "CanSubmitToWorkflow" method, so also not even possible to override.

  • drodmarin Profile Picture
    380 on at

    Hi Hafiz,

    Look this, docs.microsoft.com/.../method-wrapping-coc

    This funcionality is available since update 9.

  • Suggested answer
    Sukrut Parab Profile Picture
    71,710 Moderator on at

    3580.3005.image.JPG

    Did you try it  in extension like I shown above ? canSubmitToWorkflow method is available by default on all tables but not visible on table in AOT but shows with IntelliSense. It is available to override in table extension class or you can use option suggested above COC.

  • Community Member Profile Picture
    on at

    David, I tried using Chain of Command, but it is giving this syntax error when i try to call canSubmitToWorkflow:

    The next method cannot be invoked in method 'canSubmitToWorkflow' because it's not a Chain Of Command Method.

    Below is the code of my class:

    [ExtensionOf(tableStr(SalesTable))]

    final class SLDSalesOrder_Extension

    {

       public boolean canSubmitToWorkflow(str _workflowType)

       {

           boolean ret;

           ret = next canSubmitToWorkflow(_workflowType);

           return ret;

        }

    }

  • Community Member Profile Picture
    on at

    Sukrut, Simple method overriding won't work as I can't call super this way.

  • drodmarin Profile Picture
    380 on at

    Hi Hafiz,

    You have trying create a chain of command of a method that doesn't exist in the table. This method is a form method. 

    You need the following:

    [ExtensionOf(formStr(SalesTable))]
    final class SalesTable_PWTesting_Form_Extension
    {
        public boolean canSubmitToWorkflow(str _workflowType)
        {
            boolean ret;
           
            ret = next canSubmitToWorkflow(_workflowType);
     
            return ret;
        }

    }

    Regards.

  • Community Member Profile Picture
    on at

    DavidHow can cansubmitToWorkflow method go on form? It always is a table method.
    Even if I consider its a form method, how would you place it on List Page?

  • drodmarin Profile Picture
    380 on at

    Hafiz, cansubmitToWorkflow method is a table method, but the table belong a form datasource.

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Hafiz,

    I have spent 3 days to solve that problem. I have setup worfklow on InventTransferORder form so I do every pre-requirements( Workflow category, approvalis, tasks, workflow types, menuITems ettc.)at backround without no problem.

    However I could not override CansubmitToWorkflow method and so I could not activate my workflow.

    What I have done to achieve that problem: (no way without overlayering)

    1. I have two model. First is my customer main model. lets name it as CustAX365 model. second is my custom aplication suite model and run under standart application suite model and depends on it. lets name it as CustApplicationSuite365 model.
    2. I have customized InventTransfeTable TABLE on CustApplicationSuite365 level and Add CANSUBMITTOWORKFLOW method. only add, no more action.
    3. I have customized InventTransfeTable FORM on CustApplicationSuite365 level and update Workflow enabled, workflow datasource, workflow type properities on Design node of form.
    4. Then I use Chain of command and create a new class for InventTransfeTable TABLE extension and write my logic to cansubmittoWorkflow method on CustAX365 level.Than it works fine.
          1. [ExtensionOf(tableStr(InventTransfeTable))]

            final class InventTransfeTable_Coc_Extension

            {

               public boolean canSubmitToWorkflow()

               {

                   boolean ret;

                   ret = next canSubmitToWorkflow();

                  if(this.recID && this.WorkflowState == WorkflowState::notSubmitted && this.existLine())

                   {

                          ret = true;

                   }

                   return ret;

                }

            }


    5. than it works fine and workflow button displayed on form.

  • Community Member Profile Picture
    on at

    Mesut,

    Thanks for sharing your observation.

    Yet again, it wasn't possible without Overlayering.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans