In this post we will create a new Workflow Event . The event tied to the Dynamics NAV Sales post functionality, While posting the sales invoice based on the workflow conditions program will auto send email and update the pdf report on report inbox
You may download the object and workflow file from Dropbox Link
Scenarios
1 – Create a workflow event
The scenario is to define an event based on the on after post trigger of the sales post and expose that event as a workflow event.
2 – Create a workflow response
The scenario is to define a Send email and update the report to report inbox .
3 – Enable the workflow & response in the NAV system
This is to show managing workflow events & responses from a Dynamics NAV system to build a workflow.
1 – Create a workflow event
- Create a new codeunit
- Create a helper function OnPostCode . This function will return a code which is used by the workflow engine.
- Give the function return value of Code, length 128.
- Create New function AddEventToLibrary subscribe the function from Workfkow event handling codeunit Check the screenshot
- Create New function OnPOstSalesDoc Subscribe to sales post codeunit

2 – Create a workflow response
- Create a helper function RunSendEmailResponseCode . This function will return a code which is used by the workflow engine.
- Give the function return value of Code, length 128.
- Create New function AddResponseToLibrary subscribe the function from Workfkow Response handling codeunit Check the screenshot
- Create New function ExicuteResponse subscribe the function from Workfkow Response handling codeunit Check the screenshot

Created New function to send the email

3 – Enable the workflow & response in the NAV system
Crate New workflow Category with code MYWF and description My Workflow

New workflow created with condition amount>1000

Report inbox updated after post sales invoice

Auto email from nav
