Monday, August 17, 2015

How to find out who created/modified sales order/purchase order in Navision

question-686336_1280In standard Navision if you want to find out who created/modified a document i.e. sales order, purchase order, transfer order… you cannot unless you do have a customization or you have to enable a change log setup

 

In this blog I will discuss how to make the customization to achieve this, but if you want to know how to achieve this using change log setup please refer to the following links

http://www.archerpoint.com/blog/Posts/setting-change-logs-microsoft-dynamics-nav-2013
https://msdn.microsoft.com/en-us/library/hh169208%28v=nav.71%29.aspx?f=255&MSPPError=-2147217396

 

Please note if you are using change log to trace for insertion and modification, then don’t include all the fields in your change log setup include only some fields.

How to achieve with customization: You need to have development license to make the below modifications

This example is for Sales order but you can do the same for other documents.

Open development environment and from the Object Designer select table tab on the left hand side and choose table 36 – Sales Header

Select Design and add the following four fields,

1. Created By (Code 50)

2. Created On ( DateTime)

3. Last Modified By (Code 50)

4. Last Modified On (DateTime) 

image

The field number’s can be different. Save the change by choosing File –> Save and Then File –> Exit.

Open the table 36 again in design mode, then from Menu choose View –> View C/AL Code or Press F9

As show in the below Figure 1, you need add the custom code in the OnInsert Trigger and OnModifiy Trigger of the object

image

Figure 1: Showing Table 36 Sales Header in Design Mode C/AL Code – OnInsert and OnModify Triggers

OnInsert()
// SK0001 >>
"Created By" := USERID;
"Created On":= CURRENTDATETIME;
// SK0001 <<

OnModify()
// SK0001 >>
"Modified By" := USERID;
"Modified On" := CURRENTDATETIME;
// SK0001 <<



Save the changes by choosing File –> Save and Then File –> Exit.


Now you can go to the Sales Order Page (42) or  Sales List Page and add those fields, if you want to track this in purchase or transfer then you can repeat the same steps as above but for the purchase use  38 – Purchase Header  table and for Transfer Order – 5740 Transfer Header Table.


With these simple modifications now you can track who created/modified or when they created/modified.


Please leave your comments and suggestions.

Share:

0 comments: