web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / Error While Using Chai...
Finance forum

Error While Using Chain Of Command Invalid Token 'next'

(0) ShareShare
ReportReport
Posted on by

I override the canSubmitToWorflow() of salesTable, but the workflow should get activated only for the specified conditions. For that I was trying to create a chain of command method the code used is below,

ChainOfCommand.png

Thanks.

  • nmaenpaa Profile Picture
    101,172 Moderator on at

    1) Your class must be decorated with [ExtensionOf(formStr(SalesTable))] and be declared as final.

    2) You can't set default values for CoC method parameters

    3) Your next call must include all parameters of the standard method

  • Community Member Profile Picture
    on at

    Thanks for your reply Nikolaos,

    Code of the extension class is as below,

    [ExtensionOf(tableStr(SalesTable))]

    final class SalesTable_Extension

    {

       public boolean canSubmitToWorkflow(str _workflowType = '')

       {

           boolean ret = false;

           ret = next canSubmitToWorkflow(_workflowType);

           if (this.RecId && this.DocumentWorkflowState == DocumentWorkflowState::NotSubmitted)

           {

               ret = true;

           }

           return ret;

       }

    I didn't understand point number 2. It that means I can't write this line

    ret = next canSubmitToWorkflow(_workflowType); ??

  • nmaenpaa Profile Picture
    101,172 Moderator on at

    Point 2 means that your own method should look like this:

    public boolean canSubmitToWorkflow(str _workflowType) <- no default value

    Also, table SalesTable doesn't include method canSubmitToWorkflow (at least in 7.3), instead form SalesTable does include that. So you must extend the form SalesTable, not table SalesTable. Also, I would not name my class SalesTable_Extension, because naming conflicts are likely to occur. Instead include your three letter prefix in the object name. For example ABCSalesTable_Extension.

  • Community Member Profile Picture
    on at

    table SalesTable doesn't include method canSubmitToWorkflow -- I have overridden it using overlayering. As using extension and  defining this method it is not allowing to enable workflow for sales order.

    Form SalesTable does not contain this method, This is a standard method of table which must be overridden in order to enable workflow.

    I have not followed the best practices, I was trying to achieve this in a demo environment.

    Thanks.

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