Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to create/write "canSubmitToWorkflow" method on table extension in D365

(0) ShareShare
ReportReport
Posted on by 137

Hello everyone,

I need to create a workflow for which "canSubmitToWorkflow" method needs to be created on standard table which doesn't have canSubmitToWorkflow method but development is to be done using extensions.

In table extensions we can't override standard methods which in-turn can't create "canSubmitToWorkflow" method.

how can we achieve/write canSubmitToWorkflow method without customizing standard table.

 

*This post is locked for comments

  • Suggested answer
    Luqman Profile Picture
    125 on at
    RE: How to create/write "canSubmitToWorkflow" method on table extension in D365

    Extension of ‘CanSubmitToWorkflow’ method in standard table which is not overridden by standard:

     ‘CanSubmitToWorkflow’ is being called from FormDataUtil:: CanSubmitToWorkflow() method for which post event handler can be written, which is purely extension.

    Detail example is shared in below post by @satishttps://community.dynamics.com/ax/f/33/t/288826 

  • Evaldas Profile Picture
    1,800 on at
    RE: How to create/write "canSubmitToWorkflow" method on table extension in D365

    Looks like you are right. I have implemented this on a form that had this method therefore I was able to CoC it.

    Stupid me...

  • Sheikh Sohail Profile Picture
    6,125 on at
    RE: How to create/write "canSubmitToWorkflow" method on table extension in D365

    Hi Evaldas Landauskas

    You can override the method on custom form only. If you are working on standard form and method not already implemented so COC will not work for you.

  • Evaldas Profile Picture
    1,800 on at
    RE: How to create/write "canSubmitToWorkflow" method on table extension in D365

    Hi Sheikh,

    If you read my reply carefully you would have noticed that I wrote about a form and not a table.:)

  • Suggested answer
    Sheikh Sohail Profile Picture
    6,125 on at
    RE: How to create/write "canSubmitToWorkflow" method on table extension in D365

    Hey Evaldas Landauskas

    COC only work when method implementation already available on the table... But if the method is not implemented You can't implement the COC.

  • Suggested answer
    Evaldas Profile Picture
    1,800 on at
    RE: How to create/write "canSubmitToWorkflow" method on table extension in D365

    Hi,

    There is a solution without overlaying.

    You should create/CoC a canSubmitToWorkflow method on the form you are activating the workflow.

    1
    2
    3
    4
    5
    6
    7
    8
        public boolean canSubmitToWorkflow(str _workflowType)
        {
            boolean ret;
            
            ret = next canSubmitToWorkflow(_workflowType);
                            
            return ret;
        }
    

    Cheers :)

  • Sheikh Sohail Profile Picture
    6,125 on at
    RE: How to create/write "canSubmitToWorkflow" method on table extension in D365

    I am in agreement that In D365FO extension of canSubmitToWorkflow still not available if not override on actual table. But there is an alternate way on which I have recently worked and its working perfectly on client side.

    Please have look this blog and mark this answer as suggested if this will work for you.

    community.dynamics.com/.../avoid-over-layering-in-development-of-workflows-on-existing-form

    d365technext.blogspot.com/.../avoid-over-layering-in-development-of.html

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: How to create/write "canSubmitToWorkflow" method on table extension in D365

    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.

  • Suggested answer
    Sukrut Parab Profile Picture
    71,682 Moderator on at
    RE: How to create/write "canSubmitToWorkflow" method on table extension in D365

    Hi Krishna ,

    I got the same error when I tried to create canSubmitToWorkflow method in class extension which is not good. I think you need to override method on Custtable and then create pre /Post eventhandler and do you customization. So for now you don't have option but override method on base table and then create event handler.

    I tried for one of the existing table Purchtable and it works

    /// <summary>

       ///

       /// </summary>

       /// <param name="args"></param>

       [PreHandlerFor(tableStr(PurchTable), tableMethodStr(PurchTable, canSubmitToWorkflow))]

       public static void PurchTable_Pre_canSubmitToWorkflow(XppPrePostArgs args)

       {

       }

    Also you can submit this to Microsoft on following idea site so that they can consider it.

    ideas.dynamics.com/.../dynamics-operations

  • krishna srikanth Profile Picture
    137 on at
    RE: How to create/write "canSubmitToWorkflow" method on table extension in D365

    Giving error like below image

    Error message is :-

    "cannot define an extension method "canSubmitToWorkflow" in extension class "custTable_Extension" targeting type "custTable" because the type already defines a method with same name.

    As per above error & my understanding, "canSubmitToWorkflow" method is an override/standard method,

    by default every table consists some set of override methods and above method belongs to same.

    If i gave different naming also then AX can't identify.

    Even i have seen for events which are listed for table extensions as a separate node(Events) and i haven't find any event handler for "canSubmitToWorkflow" method as we have for others(onUpdated,onUpdating...etc)

    canSubmittoWorkflow-error.PNG

    So,how can i achieve this? as standard table doesn't have above method and now i want to write the cansubmitToWorkflow method to that table (Without overlaying) using extensions .

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,095 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans