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 / Sales forum / CanSubmitToWorkflow me...
Sales forum

CanSubmitToWorkflow method of custom table joined with SalesTable not working in SalesOrder Workflow (D365)

(0) ShareShare
ReportReport
Posted on by 120

Hi all ,

I am facing issue while creating custom sales order workflow in d365(8.1).I have joined my custom table with salestable and override cansubmittoworkflow method of custom table but it is not calling .On creating salesorder it is creating record (salesId,workflowsatus) in my custom table but it's method is not calling.Can anyone suggest me how to debug or right way to proceed sales order workflow customization.I have joined my custom table on SalesTable form.Your quick response is highly appreciated.

Categories:
I have the same question (0)
  • Suggested answer
    Adrian Begovich Profile Picture
    1,027 Moderator on at

    Hi Abdul Manan,

    This article will teach you how to debug custom workflow assemblies. We will examine your code for issues if you post it here.

  • Abdul Manan Profile Picture
    120 on at

    Dear Adrian,

    Thanks for your response.I have manage it through extention of salesTable's method cansubmittoworkflow method :

    [PostHandlerFor(classStr(FormDataUtil), staticMethodStr(FormDataUtil, canSubmitToWorkflow))]

       public static void FormDataUtil_Post_canSubmitToWorkflow(XppPrePostArgs args)

       {

           Common             record               = args.getArg(identifierStr(_record));

           SalesTable          salesTable           = record as SalesTable;

           SalesLine           salesLine;

           boolean            ret                  = args.getReturnValue();

           if (record.TableId == tableNum(SalesTable))

           {

               select firstonly salesLine where salesLine.SalesId==salesTable.SalesId;

               if (salesTable.TxlWorkflowState == TxlWorkflowState::Draft && salesLine)

               {

                   ret = boolean::true;

               }

               else

               {

                   ret = boolean::false;

               }

           }

           args.setReturnValue(ret);

       }

    Then I enabled workflow on SalesTableListPage form  like this and it is working fine.

       [FormEventHandler(formStr(SalesTableListPage), FormEventType::Initializing)]

       public static void SalesTableListPage_OnInitializing(xFormRun sender, FormEventArgs e)

       {

           FormRun                SalesTableListPage         = sender;

           FormBuildDesign SalesTableListPageDesign = SalesTableListPage.form().design();

           SalesTableListPageDesign.workflowEnabled(true);

           SalesTableListPageDesign.workflowDatasource(tableStr(SalesTable));

           SalesTableListPageDesign.workflowType(workflowTypeStr(TxlSalesOrderWFType));

       }

    I am trying to enable same workflow in SalesTable form with same procedure in Initializing event of salesTable form but

    it is not enabling.can you tell me what could be the reason of this issue.

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 > Sales

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans