Skip to content

Instantly share code, notes, and snippets.

@jvanhoesen
Created November 24, 2020 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jvanhoesen/8461bf6dd782b07f1f7f9713deddc49f to your computer and use it in GitHub Desktop.
Save jvanhoesen/8461bf6dd782b07f1f7f9713deddc49f to your computer and use it in GitHub Desktop.
Primary Data-Access-Class RowSelecting
protected virtual void _(Events.RowSelecting<AATimeRequest> e)
{
if (e.Row is AATimeRequest row)
{
using (new PXConnectionScope())
{
//If Approvals are enabled, check if the current user is the set approver
if (Setup.Current.TimeRequestApproval ?? false)
{
EPEmployee approver = PXSelectJoin<EPEmployee,
InnerJoin<EPRule, On<EPEmployee.userID, Equal<EPRule.ownerID>>,
InnerJoin<EPAssignmentMap, On<EPRule.assignmentMapID, Equal<EPAssignmentMap.assignmentMapID>>>>,
Where<EPAssignmentMap.assignmentMapID, Equal<Required<EPAssignmentMap.assignmentMapID>>>>.Select(this, SetupApproval.Current.AssignmentMapID);
if (approver != null)
{
row.IsApprover = (approver.UserID == Accessinfo.UserID);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment