Proposed assignee: setting it with an event
The dialogs Reassign Approval, Reject Related Approval and Send Back Line ask for a new assignee and propose one when they open. Without a setting that is the type the approval is currently assigned to, otherwise Approver; Default Assignee Type in the AWF Setup sets anothera fixed type. Partners and customers with their own development can go further and decide the proposal with an integration event — per dialog and per document, with a particular user or group if they like.
This page is the developer contract: the event, its parameters, the order in which the proposal comes about, and an example.
Typical use
Purchase documents are almost always handed to the purchasing group, sales documents to a particular person. A subscriber proposes the Workflow User Group PURCHASING for purchase documents and their lines; the user only has to enter the reason.
The event
Publisher: codeunit DXP AWF Assignee Defaults, integration event OnAfterGetDefaultAssignee. It is raised when one of the three dialogs opens — after Advanced Workflow has decided what to propose.
| Parameter | Meaning |
|---|---|
Dialog: Enum "DXP AWF Assignee Dialog" | The dialog that opens: Reassignment (Reassign Approval, also when delegating without a substitute), Line Rejection (Reject Related Approval) or Line Send Back (Send Back Line). |
ContextRecordID: RecordId | The record the dialog opens for: the document or the line; for a selection of several lines or approvals, the first; for Reject All, the workflow's document. Empty where the caller does not know it (see below). |
var AssigneeType: Enum "Workflow Approver Type" | The assignee type the dialog shows. Set it to propose another one. |
var AssigneeCode: Code[50] | Who is proposed: the user ID for Approver, the code of the workflow user group, the external approver or the external approver group. Leave it empty to propose only the type. It is ignored for Salesperson/Purchaser — the salesperson/purchaser comes from the document. |
How the proposal comes about
- What the workflow proposes: only when a line is rejected — the stage's rejection group, if one is set up.
- Otherwise Default Assignee Type from the AWF Setup
., if it is set.
ContextRecordID is assigned to – the type only, AssigneeCode stays empty. Not for Line Send Back; approvals from before version 1.16 do not know their type.
Otherwise Approver.
Then the event. The subscriber sees the result of 1–AssigneeType and AssigneeCode and has the last word.
Last: if the dialog does not offer the type, it becomes Approver with no code. The two line dialogs offer no external types.
Example: purchase documents to the purchasing group
codeunit 50111 "MY AWF Assignee Proposal"
{
[EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP AWF Assignee Defaults", 'OnAfterGetDefaultAssignee', '', false, false)]
local procedure ProposePurchasingGroup(Dialog: Enum "DXP AWF Assignee Dialog"; ContextRecordID: RecordId; var AssigneeType: Enum "Workflow Approver Type"; var AssigneeCode: Code[50])
begin
if Dialog <> Dialog::Reassignment then
exit;
// Purchase documents and their lines go to the purchasing group.
if not (ContextRecordID.TableNo() in [Database::"Purchase Header", Database::"Purchase Line"]) then
exit;
AssigneeType := AssigneeType::"Workflow User Group";
AssigneeCode := 'PURCHASING';
end;
}
Opening the dialogs from your own code
If your code opens one of the dialogs, pass the record along so subscribers see it:
- Codeunit
DXP AWF Page Extension Helper:GetReassignmentInput(ContextRecordID, OffersRejectionReview, …); for a selection,GetContextRecordID(…)(sales lines, purchase lines, approval entries) returns the first record. - Codeunit
DXP AWF Approval Integration:PrepareDelegateBatch(ContextRecordID, …)andGetLineRejectionInput(LineReference, ContextRecordID, TemplateCode, StageCode, …). - If you open one of the pages
DXP AWF Workflow Reassignment,DXP AWF Line RejectionorDXP AWF Line Send Backyourself, callSetContextRecordIDbeforeRunModal.
The older overloads without ContextRecordID remain; they pass an empty record.
What the event does not change
- It is only a proposal. The user can change the type and the assignee in the dialog.
- Send Back Line still opens on Approver of the Stage; the proposal applies once the reviewer turns that off.
- The checks on confirming stay: an assignee the four-eyes principle excludes is still refused — even if a subscriber proposed them.
- Without a subscriber, nothing changes.
Related pages
- Module: Approval Reassignment
- Module: Rejection Handling — rejection group and Send Back Line
- AWF Setup — Default Assignee Type