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 a 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.

ParameterMeaning
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: RecordIdThe 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

  1. What the workflow proposes: only when a line is rejected — the stage's rejection group, if one is set up.
  2. Otherwise Default Assignee Type from the AWF Setup, if it is set.
  3. Otherwise the type the open approval of 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.
  4. Otherwise Approver.
  5. Then the event. The subscriber sees the result of 1–4 in AssigneeType and AssigneeCode and has the last word.
  6. 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:

The older overloads without ContextRecordID remain; they pass an empty record.

What the event does not change


Revision #2
Created 2026-11-24 11:51:06 UTC by Bernd Feddersen
Updated 2026-11-24 12:22:36 UTC by Bernd Feddersen