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 :
Microsoft Dynamics AX (Archived)

Workflow Submit Button To Action Button change is slow

(0) ShareShare
ReportReport
Posted on by 6

Hi,

I there is custom flow for leave in personnel module, after entering leave values and validation. I press F5, this shows up Submit button. After i enter some value for submit button  and click, it goes to submit manager class. The whole operation in submit manager happens in .05 seconds.. got it from winapi::getticket. Now after submit operation has been done, Workflow button is not changing from SUBMIT to action, tried pressing F5. Also, it is possible to click submit button again, enter some value and click ok. After sometime, After one submit action alone, it changes to action by itself. Default workflows, are changing from submit to action, after the operation is completed. Please help. how to go about this issue.

*This post is locked for comments

I have the same question (0)
  • NoobDaxCoder Profile Picture
    6 on at

    It is regardless, i press one time submit or two times.. workflow button is changing from SUBMIT to ACTION.

  • NoobDaxCoder Profile Picture
    6 on at

    Table updation method is there and It is changing from SUBMIT to Action. But the change is slow, also after completing one submission. It still allows to submit once more.

  • NoobDaxCoder Profile Picture
    6 on at

    public static void main(Args args)
    {

    FormDataSource callerDS;
    FormRun formRun;


    // TODO: Write code to execute once a work item is submitted.
    // Variable declaration.
    recId _recId = args.record().RecId;
    WorkflowCorrelationId _workflowCorrelationId;
    // Hardcoded workflow type name.
    WorkflowTypeName _workflowTypeName = workflowtypestr("PayLeaveWorkflow");
    // Initial note is the information that users enter when they
    // submit the document for workflow.
    WorkflowComment _initialNote = "";
    WorkflowSubmitDialog workflowSubmitDialog;

    // Opens the submit to workflow dialog box for user comments.
    workflowSubmitDialog = WorkflowSubmitDialog::construct(args.caller().getActiveWorkflowConfiguration());
    workflowSubmitDialog.run();

    if (workflowSubmitDialog.parmIsClosedOK())
    {
    _recId = args.record().RecId;

    callerDS = args.record().dataSource();
    formRun = args.caller();
    // Get user comments from the submit to workflow dialog box.
    _initialNote = workflowSubmitDialog.parmWorkflowComment();

    try
    {
    ttsbegin;

    // Activate the workflow from a template.
    _workflowCorrelationId = Workflow::activateFromWorkflowType(_workflowTypeName, _recId, _initialNote, NoYes::No);

    ttscommit;

    // Updates the workflow button to diplay Actions instead of Submit.
    args.caller().updateWorkflowControls();
    callerDS.research(true);
    callerDS.reread();
    callerDS.refresh();

    }

    catch(exception::Error)
    {
    // ToDo Insert your error code here.
    }
    }


    }

    Hi, Please check the code and review, I am not sure what is missing.. If it is not changing it is different thing. It is changing, but slow.

  • Verified answer
    RaviRaj Profile Picture
    530 on at

    Hi Noobdaxcoder,

    Try this code

    public void submit(Args _args)

    {

       // Variable declaration.

       SalesTable                                         salesTable;                 //declare your table

       SalesOrderTypeSubmitManager       submitManger;        //here use your submit  class

       recId _recId =                                   _args.record().RecId;

       WorkflowCorrelationId                    _workflowCorrelationId;

       workflowTypeName                    _workflowTypeName =  

       workFlowTypeStr("Yourworkflowquery");      //your workflow query put here

       WorkflowComment              note = "";

       WorkflowSubmitDialog        workflowSubmitDialog;

       submitManger =                  new SalesOrderTypeSubmitManager();  //here use your submit  class

       //Opens the submit to workflow dialog.

       workflowSubmitDialog =

      WorkflowSubmitDialog::construct(_args.caller().getActiveWorkflowConfiguration());

       workflowSubmitDialog.run();

       if (workflowSubmitDialog.parmIsClosedOK())

       {

           salesTable = _args.record();

           note = workflowSubmitDialog.parmWorkflowComment();

           try

           {

               ttsbegin;

               // Activate the workflow.

               _workflowCorrelationId = Workflow::activateFromWorkflowType(_workflowTypeName, salesTable.RecId,             note, NoYes::No);

               salesTable.WorkFlowStatus = WorkFlowStatus::Submitted;

               salesTable.update();

               ttscommit;

            }

           catch (Exception::Error)

           {

               error("Error on workflow activation.");

           }

       }

       _args.caller().updateWorkFlowControls();

    }

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans