Skip to content

Instantly share code, notes, and snippets.

@BrianMRO
Created September 28, 2021 13:55
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 BrianMRO/1fb4359ee10b740c3d25d0b05e55f288 to your computer and use it in GitHub Desktop.
Save BrianMRO/1fb4359ee10b740c3d25d0b05e55f288 to your computer and use it in GitHub Desktop.
Approval Optional
#region RemoveHold Action
public PXAction<MyDAC> RemoveHold;
[PXButton(CommitChanges = true), PXUIField(DisplayName = Messages.RemoveHold)]
protected virtual IEnumerable removeHold(PXAdapter adapter)
{
MyDAC myRecord = Document.Current;
if (myRecord != null)
{
// Set the RequestApproval field
Document.SetValueExt<MyDAC.requestApproval>(myRecord, RequireApproval(myRecord));
Document.Update(myRecord);
// Refresh the SetupApproval view so the logic in the constructor clears the
// maps to prevent approval or retrieves the list of approval maps to consider
SetupApproval.View.RequestRefresh();
}
return adapter.Get();
}
#endregion
#region RequireApproval
protected virtual bool? RequireApproval(MyDAC myRecord)
{
// Logic to decide if approval is required
// Return True if approval should be requried
// Return False if approval should not be required
}
#endregion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment