Dear Sir,
The approval system is configured in the NAV 2016 Database with Email Notification. The Email Notification carries Document Details. And now I want to add two Action buttons one for Approve & another for Reject in Email body. So that approver can take decision & update the Navision Data from there.
If the Approver wants to reject the document he will click Reject button or if he/she wants to approve then click the Approve button. These two buttons will serve the purpose without login the NAV System.
How to do?
Now or Never
0
Answers
Supposing the user is using an email client in a windows environment, why not publish a page in the webservices section of NAV. The page is based on a table that has 3 fields:
1 Primary Key (int)
2 ApprovalEntryNo (int)
3 ApproveReject (bln)
Put field 2 and 3 in the page.
Adjust NAV at the point where the email is created. Use C/AL to add 2 links in the email. You can use HTML encoding to show the words APPROVE and REJECT instead of the entire link.
Approval link:
https://NAV.TheCompany.nl/Instance/?company=Cronus&page=50000&filter=ApprovalEntryNo IS 123456 AND ApproveReject IS TRUE
Rejection link:
https://NAV.TheCompany.nl/Instance/?company=Cronus&page=50000&filter=ApprovalEntryNo IS 123456 AND ApproveReject IS FALSE
Create code in you page using
GETFILTER(ApprovalEntryNo)
GETFILTER(ApproveReject)
to retreive the values you are looking for to handle the approval/disapproval. Handle the approval/disaproval from there.
1. Set\registrtion technical e-mail: autoapproval@mycompany.com (autoapprovalMyCompany@google.com)
2. Set 2 tags in e-mail body
<span class=MsoHyperlink><a href="mailto:%BM1000?subject=APPROVE&body=entryno~%BM1010~guid~%BM1020~action~1~">Approve</a></span> <br>
<span class=MsoHyperlink><a href="mailto:%BM1001?subject=REJECT&body=entryno~%BM1011~guid~%BM1021~action~0~">Reject</a></span> <br>
%BM - technical bookmark for set data
3. in %BM1021 set autoapproval@mycompany.com
After push Approve\Reject in body E-Mail, send mail with different subject, on inbox autoapproval@mycompany.com
4. Set Job on NAS scheduler with run newMyMailCU.
newMyMailCU get all mails from inbox (its own email, see st.1) autoapproval@mycompany.com
5. Parse mail Subject by Action 0\1 and,
run Approval\Reject Action in standard "workflow entry" where guid in email = guid in "approval entry"
Sample all text body:
<html>
<body lang=ENU link=blue vlink=purple style='tab-interval:35.4pt'>
%BM2000<br>
please,<br>
approve next order
<span class=MsoHyperlink><a href="%BM1001">%BM1000</a></span> <br>
<span class=MsoHyperlink><a href="mailto:%BM1021?subject=APPROVE&body=entryno~%BM1022~guid~%BM1023~action~1~">Approve</a></span> <br>
<span class=MsoHyperlink><a href="mailto:%BM1031?subject=REJECT&body=entryno~%BM1032~guid~%BM1033~action~0~">Reject</a></span> <br>
</body>
</html>
Thanks for your replies.
The Approver must have a valid USERID in the Navision & as well as in the User Setup Master Table.
The same business logic should be executed while making any decision from the Email Notification (Approve/Reject) as normal. -- This is the requirement.
[ If any reason, the Approver does not belong to the Navision User family then I will pass a valid Nav user (hardcoded) through the Action button ]--- Please do not focus on this point now.
I used my method in Nav 4..Nav18,
when the boss in another country, with any mail reader. This worked even when the Nav was offline at the time of approval:
My custom table 50000 EmailItemOut, and codeunit 50000 ApprovalDispatcher
Var
Name DataType Subtype Length
ApprovalMgt Codeunit Approvals Mgmt.
OnRun(VAR Rec : Record "Approval Entry")
ApprovalEntry := Rec;
CASE EmailItemOut."Action Type" OF
EmailItemOut."Action Type"::Approve : ApprovalMgt.ApproveApprovalRequest(ApprovalEntry); //core Approve
EmailItemOut."Action Type"::Reject : ApprovalMgt.RejectApprovalRequest(ApprovalEntry); //core Reject
END;
Rec := ApprovalEntry;
Var
Name DataType Subtype Length
ApprovalMgt Codeunit Approvals Mgmt.
SetEmailOut(VAR pEmailItemOut : Record "Email Item Out")
EmailItemOut := pEmailItemOut;
=========================
ReadInEmail and run action in "subject" and guid ApprovalEntry
LOCAL RunApprovalDispatcher()
WITH InMail DO BEGIN
GetOutEmailForInEmail(InEmail,OutMail);
ApprovDispL.SetEmailOut(OutMail); //cu50000
IF NOT ApprovDispL.RUN(ApprovalEntry) THEN BEGIN
"Error Code" := 01; //core ApprovalMgt on run action
"Error Text" := COPYSTR(GETLASTERRORTEXT,1,MAXSTRLEN("Error Text"));
END;
END;