Validation in workflow approval process

Helllo  frnds... i have a senario in workflow process ; in which when approvar click on approved event then validation will be done ( generally in my case table field for Ex demo is empty then its show error please fill demo field then again press approved button ; if demo field is not empty then by clicking approved event workflow status will be changed.................

  • Hi,

    Write your validation code in class and point its menu item in Approvals outcomes(your case Approve) property ActionMenuItem and call default Approve menu item by X++ code.

  • In reply to Thariq:

    public void completed(WorkflowElementEventArgs _workflowElementEventArgs)
    {
    AmyGrievanceRequest AmyGrievanceRequest;

    ttsbegin;
    select forupdate AmyGrievanceRequest
    where AmyGrievanceRequest.RecId ==
    _workflowElementEventArgs.parmWorkflowContext().parmRecId()
    ;
    if(AmyGrievanceRequest.ActionTaken != "")
    {
    AmyGrievanceRequest.AmyGrievanceWorkflowStatus =
    AmyGrievanceWorkflowStatus::Accepted;
    AmyGrievanceRequest.update();
    }
    else if(AmyGrievanceRequest.ActionTaken == "")
    {
    throw error ("Please Select Action Type");
    }
    ttscommit;
    info(strFmt("%1",AmyGrievanceRequest.ActionTaken));
    }

    this is my code but their is one problem in my code when ActionTaken field is empty then i want workflow execution process is automatically stop ; compiler throw out execution of my code . Then approval must field value in ActionTaken field then again click approve menuItems to complete workflow process
  • In reply to MayurSaini:

    Yes, follow the previous reply.
Related
Recommended