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


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

Advertisement

Author: Akhilesh E Kartha

Experienced BC Developer with 10 years history of working in the information technology and services industry. Skilled in Microsoft Dynamics NAV & D365 Business Central, Strong experience in C/AL, Extension Development, Requirements Analysis, Effort Estimation, Integrations, Version Upgrade,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: