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?
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.
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)
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);
If you've found this thread useful, dive deeper into User Group community content by role