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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Extend canSubmitToWorkflow method which does not exist in table

(0) ShareShare
ReportReport
Posted on by

Hi All guys,

I want to enable table workflow, but I don't know how to extend the canSubmitToWorkflow method in my extension class, who has this experience to share with me? thanks.

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    same question, How do i extend canSubmitToWorkflow  method in form, I try to add this method to my extension class, It seems as if added method is unuseful.

  • Verified answer
    Satish kakileti Profile Picture
    185 on at

    Hi Sarah,

    This can be achieved through COC,

    I hope following code would help you,

    [ExtensionOf(tableStr(<YourTableName>))]

    final class <YourTableName>_Extension

    {

      public boolean canSubmitToWorkflow()

      {

          boolean ret;

          ret = next canSubmitToWorkflow();

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

          {

                 ret = true;

          }

          return ret;

       }

    }

    Thanks,

    Satish K.

  • Community Member Profile Picture
    on at

    Hi Satish,

    please have a look at error below,  need I overlay this method in table?

  • Community Member Profile Picture
    on at

    Error message: The next method cannot be invoked in method 'canSubmitToWorkflow' because it's not a chain of Command method.

  • Verified answer
    Satish kakileti Profile Picture
    185 on at

    Hi Sarah,

    I want to mention one thing here,

    We can use COC only for the table methods which are already overridden.  If the method, CanSubmitToWorkflow is not overridden, we have to customize the table and proceed with over-layering this method.

    Thanks,

    Satish K.

  • Suggested answer
    Community Member Profile Picture
    on at

    sarah guan,

    You can not achieve this without overlayering until now. Maybe MS provides some way in future releases.

  • Community Member Profile Picture
    on at

    Hi all guys,

    I extends form method

    [FormDataSourceEventHandler(formDataSourceStr(MyForm, ProjInvoiceTable), FormDataSourceEventType::Initialized)]

       public static void ProjInvoiceTable_OnInitialized(FormDataSource sender, FormDataSourceEventArgs e)

       {

           sender.formRun().design().workflowEnabled(true);

           sender.formRun().design().workflowDatasource(formDataSourceStr(MyForm, ProjInvoiceTable));

           sender.formRun().design().workflowType("workFlowType");

       }

    I open form after building, an error message always pop up saying 'Object reference not set to an instance of an object' when I set property workflowEnabled to true. same error displayed if I override the form to modify this property, I really don't know how to give value to this property for now, who have this solution to share with me? my verison is PU12.

  • Sheikh Sohail Profile Picture
    6,125 on at

    As we all knows that in D365 there is limitation to create workflow on existing table because in Extension we couldn't write canSubmitWorkflow method, You have to over-layer the table and than override the canSubmitWorkflow Method....

    But there is an alternate way I found to avoid over layering on systems table.

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

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

    Please mark this Answer as suggested if above blog is use full for you.

    Thank you

    Sheikh Sohail Hussain

  • Suggested answer
    Satish kakileti Profile Picture
    185 on at

    Hi Guys,

    Please go through the below link, I have provided solution for the same with out any overlayering.

    community.dynamics.com/.../288826

    Thanks,

    Satish Kakileti.

  • Suggested answer
    Satish kakileti Profile Picture
    185 on at

    Check this...

    community.dynamics.com/.../844485

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans