Implementing Nav 2016 Workflow Events and Response for Sales Invoice auto send email

Standard

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

  1. Create a new codeunit
  2. Create a helper function OnPostCode .  This function will return a code which is used by the workflow engine.
  3. Give the function return value of Code, length 128.
  4. Create New function AddEventToLibrary subscribe the function from Workfkow event handling codeunit Check the screenshot
  5. Create New function  OnPOstSalesDoc Subscribe to sales post codeunit

1

2 – Create a workflow response

 

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

 

2

Created New function to send the email

Email function

 

3 – Enable the workflow & response in the NAV system

Crate New workflow Category with code MYWF and description My Workflow

WorkflowCategory

New workflow created with condition  amount>1000

New workflow

 

 

 

Report inbox updated after post sales invoice

reportbox

Auto email from nav

Email

Advertisements