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

while pressing reject in Actions in Custom workflow,i found that the reject occurred but i found actions includes Cancel,Submit,View history

(0) ShareShare
ReportReport
Posted on by 10,280

plz somebody help me to resolve this issue ;i need Action includes only View history After rejected status added.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    syed baber Profile Picture
    11,633 on at

    Hi Codehunter,

    After rejecting a workflow, the workflow framework automatically provides this option so that the workflow can be resubmitted after making correction in the workflow document. If you want to stop the worklfow instance, then you may want to invoke the 'Cancel' option on workflow instead of reject.

    Thanks,

    Baber.

  • Codehunter Profile Picture
    10,280 on at

    is there no way to hide submit action and leave cancel Visible??

    Secondly,After cancelling the workflow,the status doesnt change to Cancel but at the meantime,the workflow status is cancelled and here is the code below::

    public void returned(WorkflowElementEventArgs _workflowElementEventArgs)

    {

      //LedgerJournalTrans LedgerJournalTrans;

       LedgerJournalTable ledgerJournalTable;

       /*select forupdate ledgerJournalTable

       where ledgerJournalTable.JournalNum == LedgerJournalTrans.JournalNum;*/

       select forupdate ledgerJournalTable

       where ledgerJournalTable.RecId == _workflowElementEventArgs.parmWorkflowContext().parmRecId();

       if(ledgerJournalTable.RecId)

       {

       ledgerJournalTable.ExpenseApprStatus=ExpenseApproStatus::Rejected;

      // LedgerJournalTrans.ExpenseApprStatus = ItemApprStatus::Rejected;

            ledgerJournalTable.write();

       ledgerJournalTable.update();

      // LedgerJournalTrans.update();

       }

    }

  • syed baber Profile Picture
    11,633 on at

    Hi Codehunter,

    I didn't get your point. Why do you want to hide the submit option after rejection? I don't know if there is a way to do this. Can you please further elaborate your requirements please?

  • Suggested answer
    Faisal Fareed Profile Picture
    10,796 User Group Leader on at

    Hi Codehunter,

    For your first point, I don't think you can control the visibility of workflow statuses (Submit, Approved, Cancelled, Rejected) based on different action taken on workflow. You really have to explain your requirements very clearly so we can guide you correct way of using built in functionality of workflow.

    Have you checked workflow tutorial form is running to capture workflow processes? Workflow status changes after few seconds. Did you see history of the workflow was it really cancelled and there is no error. You could also debug workflow to get more in depth knowledge about workflows.

  • Codehunter Profile Picture
    10,280 on at

    the cancelled status was resolved but  i found that its impossible to hide those Actions(resubmit,cancel) incase of reject status ;Additionally,i need to disable the reviewer to edit the form but allow the approver or next assignee to edit any fields in the form;plz help me on completing all the cycle of Workflow.

    thanks

  • Suggested answer
    syed baber Profile Picture
    11,633 on at

    Hi Codehunter,

    To enable/disable any fields based on next assignee, you need to find the approval or task owner first and then based on that, you can enable/disable the fields on form. Check the example below, same code is written there:

    \Forms\CustFreeInvoice\Data Sources\CustInvoiceTable\Methods\active.

    Go through the code and let me know if you have any issues.

    Thanks,

    Baber.

  • Codehunter Profile Picture
    10,280 on at

    plz can you post samples of codes per line so i can follow up

  • Suggested answer
    syed baber Profile Picture
    11,633 on at

    Hi Codehunter,

    Below is the code I was referring to inside active method:

    boolean isUserTaskOwner;

    boolean isUserApprovalOwner;

    if (custInvoiceTable.WorkflowApprovalStatus == CustFreeInvoiceWFApprovalStatus::PendingCompletion)

       {

           isUserTaskOwner = custInvoiceTable.isUserTaskOwner();

       }

       else if (custInvoiceTable.WorkflowApprovalStatus == CustFreeInvoiceWFApprovalStatus::ChangeRequested)

       {

           isUserTaskOwner = custInvoiceTable.isUserTaskOwner();

           isUserApprovalOwner = custInvoiceTable.isUserApprovalOwner();

       }

       else

       {

           isUserTaskOwner = false;

           isUserApprovalOwner = false;

       }

    isUserTaskOwner and isUserApprovalOwner methods are on CustInvoiceTable and definition is as follows:

    public boolean isUserTaskOwner()

    {

       return WorkflowWorkItem::isUserTaskOwner(this);

    }

    public boolean isUserApprovalOwner()

    {

       return WorkflowWorkItem::isUserApprovalOwner(this);

    }

    Based on the value of isUserApprovalOwner or isUserTaskOwner, you can enable/disable the editing on datasource as shown below:

    CustInvoiceTable_ds.allowEdit(isUserApprovalOwner || isUserTaskOwner);

    Please verify and and let me know if you have further queries.

    Thanks,

    Baber.

  • Codehunter Profile Picture
    10,280 on at

    i added that mentioned code above besides i found some codes in Active method;please verify if that code written below correct plus i need to know what line should add enable/disable fields.

    int active()

    {

       int ret;

       boolean isUserTaskOwner;

    boolean isUserApprovalOwner;

    if (LedgerJournalTable.ExpenseApprStatus == ExpenseApproStatus::Submitted)

      {

          isUserTaskOwner = LedgerJournalTable.isUserTaskOwner();

      }

      else if (LedgerJournalTable.ExpenseApprStatus == ExpenseApproStatus::Resubmitted)

      {

          isUserTaskOwner = LedgerJournalTable.isUserTaskOwner();

          isUserApprovalOwner = LedgerJournalTable.isUserApprovalOwner();

      }

      else

      {

          isUserTaskOwner = false;

          isUserApprovalOwner = false;

      }

       element.setAccountAccess();

       journalFormTable.datasourceActivePre();

       ret = super();

       journalFormTable.datasourceActivePost();

       element.setAccountAccess();

       element.showProperJournalLinesButton();

       element.setLinesGeneratePaymentsLabelAndHelpText();

       dimensionDefaultingController.activated();

       return ret;

    }

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 34

#2
Michel ROY Profile Picture

Michel ROY 14

#3
Jagadabi Profile Picture

Jagadabi 6

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans