Hello Gang,
As you may have noticed there is a logcal issue in Acumatica’s Approval Map Workflow injection to the Document workflow. In document worflow if an action is not allowed, its buttom is hidden but in Approval Map WF, the “Approve” & “Reject” buttons are always visible whether or not that user is an authorized approver. When user clicks on Approve/Reject then if not an authorized user, receives an error that “You are not an authorized approver!” What I want to do is to hide the Approve/Reject if the user is not an authorized approver. Here is my code. I do not get any error but the buttons are always visible. What I’m doing wrong?
protected virtual void APInvoice_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
APInvoiceEntry_ApprovalWorkflow graphExt = Base.GetExtension<APInvoiceEntry_ApprovalWorkflow>();
APInvoice document = Base.Document.Current;
EPApproval approval = PXSelect<EPApproval,
Where<EPApproval.refNoteID, Equal<Required<EPApproval.refNoteID>>,
And<EPApproval.status, Equal<Required<EPApproval.status>>,
And<EPApproval.ownerID, Equal<Required<EPApproval.ownerID>>>>>,
OrderBy<Asc<EPApproval.approvalID>>>
.Select(Base, document.NoteID, EPStatuses.Pending, Base.Accessinfo.ContactID).FirstOrDefault();
bool Visible = (approval != null) ? true : false;
graphExt.approve.SetVisible(Visible);
graphExt.reject.SetVisible(Visible);
}