Open Forum

Expand all | Collapse all

Workflow Notification back to Requestor

  • 1.  Workflow Notification back to Requestor

    Posted Oct 20, 2016 10:39 AM

    I had heard at Summit that a few people had figured out how to close a workflow by sending a notification back to the requesting user that the approval has happened.  Can someone walk through how you are doing this?

    ------------------------------
    Chris Farmer
    IT Project Manager
    TMG Gases
    Bryan TX
    ------------------------------


  • 2.  RE: Workflow Notification back to Requestor

    TOP CONTRIBUTOR
    Posted Oct 20, 2016 04:39 PM

    You'll need the Application Builder license in order to modify this. Or you can ask your VAR to make the change for you.

    The change need to be made on codeunit 1535 on NAV2016. If you're using versions prior to NAV2016, it will be on codeunit 439.

    The code needs to be in the ApproveApprovalRequest or the ApproveSelectedApprovalRequest function depending on which version you're using.

    Basically, you find the first of the approval entry record (that will be the requester) and send an e-mail to the first approval entry of the approval chain.

    ------------------------------
    Alex Chow
    Dynamics NAV MVP
    AP Commerce
    Los Angeles CA
    Blog: www.dynamicsnavconsultant.com



  • 3.  RE: Workflow Notification back to Requestor

    Posted Oct 28, 2016 05:01 PM

    Or you can add it to the response library to be able to reuse it as a response in any workflow on code unit 1521 (Workflow response handling)

    AddResponseToLibrary(CreateNotificationToRequestorEntryCode,0,CreateNotifOriginatorEntryTxt,'GROUP 0')

    and then look for the "Created by User ID" of  entry point

    CreateNotificationToRequestorEntry(Variant : Variant;WorkflowStepInstance : Record "Workflow Step Instance")

    IF WorkflowStepArgument.GET(WorkflowStepInstance.Argument) THEN;
    WorkflowStepInstance.RESET;
    WorkflowStepInstance.SETRANGE(ID, WorkflowStepInstance.ID);
    WorkflowStepInstance.SETRANGE("Entry Point", TRUE);
    WorkflowStepInstance.FINDFIRST;

    ApprovalEntry.SETRANGE("Workflow Step Instance ID", WorkflowStepInstance.ID);
    ApprovalEntry.FINDFIRST;
    RecRef.GETTABLE(ApprovalEntry);
    NotificationEntry.INIT;
    NotificationEntry.Type := NotificationEntry.Type::Approval;
    NotificationEntry."Recipient User ID" := WorkflowStepInstance."Created By User ID";
    NotificationEntry."Triggered By Record" :=RecRef.RECORDID;
    NotificationEntry."Link Target Page" := WorkflowStepArgument."Link Target Page";
    NotificationEntry."Custom Link" := WorkflowStepArgument."Custom Link";
    NotificationEntry.INSERT(TRUE);

    ------------------------------
    JUAN CRISPIN
    Chewy.com
    Pompano Beach FL



If you've found this thread useful, dive deeper into User Group community content by role