Warehouse management module 2017 Part 2 - Pick an item and ship it out of white warehouse

Pick an item, bring it into shipping bay and then ship it out of white warehouse.

I've selected white warehouse in this blog,

I need to sell an Item 80207-Mouse from our white warehouse which is in bin No. "W-04-0009" and it has to be shipped out of white warehouse.

If you select blue or some other warehouse where bin is not enabled then you just enter quantity,
Qty. to ship.
In ribbons of sales order click on
   post -> ship.

But in our example we've chosen white warehouse which is bin enabled that means,
we should also know the location of inventory apart from location of warehouse.

To do so,

1. create sales order, enter quantity
2. Release, (don't close the purchase order)

3. Click the action button Create Whse. Shipment in sales order ribbons.
(on doing this basically it sends instruction to warehouse that, I need to ship 80207-Mouse out of bin "W-04-0009")

4. Click on Create Pick from the ribbons (You can assign a user of your choice or leave it blank)
A warehouse shipment will be released.

5. role-center page of warehouse -> Click on Unassigned Picks - > Choose your pick from the list
which you created recently.

6. In Ribbons of Unassigned picks page -> Autofill Qty. to Handle -> Register Pick

7. Come back to warehouse shipment page, select the shipment which you had recently created in step 3, In ribbons -> Post -> Ship

Verify in items and bin-contents whether our item which was sold recently is updated in Qty. on Hand field.


Warehouse management module 2017 Part 1 - Purchase an item and place it in bin of white warehouse

To purchase an item and place it in white warehouse bin,


I've selected white warehouse in this blog,

I need to purchase Item 80207-Mouse from vendor and it has to be placed in white warehouse.

If you select blue or some other warehouse where bin is not enabled then you just enter quantity,
Qty. to receive.
In ribbons of purchase order click on
   post -> Receive.

But in our example we've chosen white warehouse which is bin enabled that means,
we should also know the location of inventory apart from location of warehouse.

To do so,

1. create purchase order, enter quantity
2. Release, (don't close the purchase order)
3. Click the action button Create Whse. Receipt in purchase order ribbons.
4. Post the receipt.

Now we've created a put-away activity for warehouse.
Ex. Our item is now pulled in the receiving bin no. "W-04-0009".

We've Pulled inventory in receiving bay that's it, but it has not been put away in bin's in/stock(I mean inventory location).

System automatically creates activity to do that by choosing Warehouse put-away from role-center page of warehouse.

5.  role-center page of warehouse -> Click on Warehouse put-away - > In ribbons click Register put-away.

Verify in items and bin-contents whether our purchased item is updated in Qty. on Hand field.


How to use RecordRef, KeyRef and FieldRef - Dynamics NAV 2017

This is the most unanswered question of all time, so I just thought of writing a blog on this.

This blog covers basic understanding of RecordRef, FieldRef and KeyRef in Dynamics NAV 2009 R2 to 2017 versions.
As we all know, RecordRef and FieldRef plays an important role while programming in NAV.

I hope this blog should help for many beginners.

Following are the topics covered in this blog.

1. How and when to use GETTABLE Function and OPEN Function
2. How and when to use RecordRef
3. How and when to use FieldRef
4. How and when to use KeyRef


1. GETTABLE:

 This function gets the table of a Record variable and causes the RecordRef to refer to the same table. Any filters that are applied to the RecordVar are also applied to 
the RecordRefVar.  Another way to select the table to which a RecordRef refers is to use the OPEN Function(RecordRef) and specify a table number in the parameters.

Ex: TableRecRef.GETTABLE(ContactRec);
Here, ContactRec variable gets the contact table using GETTABLE function and causes TableRecRec (a RecordRef variable) to refer to contact table.

OPEN Function:
Causes a RecordRef variable to refer to a table, which is identified by its Table ID
Ex: SearchIn.OPEN(RecRef.NUMBER);
SearchIn is a RecordRef variable which refers directly to a table, now you will be thinking which is the table it is actually trying to open here. Well, for now lets assume RecRef is holding the value of TableRecRef i.e Contact table.
So, in order to open a table through RecRef you should specify ID of the table, if you 've already used GETTABLE in your code then the same variable's ID can be passed here. That's where actually you see the difference of GETTABLE and OPEN Function but having a close look both does a same job. You can either use GETTABLE or OPEN function to create a reference of the table through RecordRef.

2. RecordRef
Let us assume you have created a function called "Search". This Search function will search for the string "fur" in any part  "Search Name" field of "Contact" table, "Customer" table and "Vendor" table.
Contact Table having Search Name field
Customer Table having Search Name filed


Now, All the 3 tables, "contact", "customer" and "vendor" table has the 3rd field name as "Search Name".
So, here comes the meaning of RecordRef. You use a RecordRef object in functions that must apply to more than one table, not to a specific table.
Instead of writing 3 functions, 1 for customer, 1 for contact and 1 for vendor table we can use one common  function which can use one RecordRef variable, which Gets the required table dynamically based on your selection.

3. FieldRef
Let's say you've selected "contact" table and the RecordRef is holding this table.
Now, you need to use a field "Search Name" from this table to search for the string "fur". How do you do that? That's where FieldRef concept comes into picture. This complex data type identifies a field in a table and gives you access to this field.
Suppose, i've created a fieldref variable "SearchFieldNo". I need this variable to refer to "Search Name" Field using. 
"Search Name" field as a field No. 3 in every existing tables.
So, this is how I can create a Field Reference for "Search Name" field.
Ex.:
SearchFieldNo := 3; //SearchFieldNo is a fieldref variable which should refer to Field No. 3 "Search Name".
SearchInFld := SearchIn.FIELD(SearchFieldNo); //SearchIn is a RecordRef variable which holds selective table.

4. KeyRef
We're now done with most of the things, we have now a RecordRef variable which is holding to the "Contact" table and referred to the field "Search Name". Now, if you need to know what is the key the contact table is holding, then you need to use KeyRef. So, KeyRef is used to Identify a key in a table and the fields in this key.

If you need to identify the primary key fields, then use the index 1 to identify it.
Ex.
KeyNo := 1; //Keynumber of which we want to get the name.
Table.OPEN(RecRef1.NUMBER); //Table is a new RecordRef variable, and RecRef1 will be holding contact table.
Key := Table.KEYINDEX(KeyNo); // Create a key reference to the key we want to get the name from.

I guess, those who read this blog might have understood the best use of RecordRef, FieldRef, GetTable function and Open function.

If you've any questions, please drop in a mail.
mail id:  mail2harikiranbm@gmail.com

How to add user permission for Add-on specific objects

If you have created a new Add-on objects and now you need to execute these objects in the customer environment(Ex. Page 12103540, Page 12103560).
So, these object id's which are not a part of Dynamics NAV needs a permission to execute or modify or insert in some other workstations.

So, here is the sample code, permissions in the below code are assigned to TableData(you can change it to page or any other object based on your requirement).

Global variables.
Name                            DataType      Subtype            Length
UserRole                          Record Permission Set
Permission                       Record Permission
AllObj                             Record AllObj
User                               Record User
WindowsLogin                  Record User
WindowsAccessControl Record     Access Control

1. Assign the new user Role ID and User Role Name
2. If not user role inserted then sort the record based on object and object id's.
3. Fetch the Permission Role ID(insert,modify,delete,execute) from permission set table and assign it to permission table for the object id's which you need to assign permission.

Example:

UserRole."Role ID" := 'Addon1';
UserRole.Name := 'Required for all user';
IF NOT UserRole.INSERT THEN ;
AllObj.RESET;
AllObj.SETRANGE("Object Type",AllObj."Object Type"::TableData);
AllObj.SETFILTER(
  "Object ID",
  '12103560..12103580');
IF AllObj.FIND('-') THEN
  REPEAT
    Permission."Role ID" := UserRole."Role ID";
    Permission."Object Type" := AllObj."Object Type";
    Permission."Object ID" := AllObj."Object ID";

    Permission."Read Permission" := Permission."Read Permission"::Yes;
    IF AllObj."Object ID" IN [12103540, 12103560] THEN BEGIN
      Permission."Insert Permission" := Permission."Insert Permission"::Yes;
      Permission."Modify Permission" := Permission."Modify Permission"::Yes;
      Permission."Delete Permission" := Permission."Delete Permission"::Yes;
      Permission."Execute Permission" := Permission."Execute Permission"::Yes;
    END ELSE BEGIN
      Permission."Insert Permission" := Permission."Insert Permission"::" ";
      Permission."Modify Permission" := Permission."Modify Permission"::" ";
      Permission."Delete Permission" := Permission."Delete Permission"::" ";
      Permission."Execute Permission" := Permission."Execute Permission"::" ";
    END;
    IF NOT Permission.INSERT THEN ;
  UNTIL AllObj.NEXT = 0;


How to use code coverage tool (How it differs from debugger)

Code coverage is one of the interesting topic while testing and debugging. It is very useful when you want to test your work.

I can start this explanation with a very good example.

Suppose you have a sound recorder in your mobile, you will go to the app folder, you will open the sound recorder, start the sound recorder, hum a tune and will record it for some time. Once you are done with humming a tune/song. You will stop recording and start listening to the tune/song which you've recorded.

Well, Exactly in the same way even code coverage tool works.
Firstly to open a code coverage tool in RTC(Role Tailored Client) Go to the following path in RTC.

If you are on Company Cronus USA,
Then in the menusuite go to,
  • CRONUS USA, Inc./Departments/Administration/Application Tools/
  • Click on Code Coverage in application tools. 
  • Click on Start button.


Now continue with your actions which you are supposed to do on RTC.
Example: I clicked on release sales order and did some processing of some random action.

Now, when you come back to code coverage and click stop.

It displays where all the flow passed through internally when you clicked on action button. You can just have a quick look at the flow of actions during your test activity.


So where all you see the Coverage% as 100. At those places the code as been hit internally when you clicked on particular action button. However, you cant see the values here directly. This gives a quick flow of code but doesn't give data i.e updating. If you need to know the complete flow internally along with values updating internally then you need to go with Debugger in NAV.

Click on Tools in NAV IDE -> Debugger -> Debug Session
Assign a break point in a code and start debugging each and every lines of code. 

Hope this helps for many beginners :)

Concept of Job Queues (Lets go through the path of NAS Service in Dynamics NAV)

Job Queue enables to request, control the processing of report and execution of codeunit.
In job queue entries window, we enter the request for execution of report/codeunit. 

Once the job queue execution of codeunit/report is done it will update its status of success/failure in Job queue log entries.


In NAV 2015, 2016 Job Queue can be activated in 2 ways.

1. Manually with credentials of Server instance.  
2. through NAS server with credentials of user.


Job queue uses NAS to run objects automatically. 

So, before understanding job queue we need to know what is NAS, why we need NAS.

In this blog I will be discussing particulary the concept of NAS and how to configure it in various versions of NAV.

What is NAS ?
NAS service is a middle-tier server component that executes the business logic without user interaction. 
In NAV it supports application like microsoft office outlook integration and NAV job queue.  

Why we need NAS?
  • Efficiency and convenience - Create a separate instance for each NAS Service so that it doesn't interrupt other services. 
  • Performance - Configuring NAS to separate instance makes better use of server computer. It allows us to run more application with less degradation.
  • Efficient error tracking - If the NAS service terminates then it can be handled like any other windows service by configuring the recovery tab on server configuration tool in control panel to manage service. 

Configuring NAS server in NAV 2009, 2013 is different from configuring in NAV 2013 R2, 2015, 2016.

Earlier all the services were separate but now we can see the services like Client, SOAP. ODATA, NAS, Management services all in one single administration tool. This makes a way by running one instance it will make run many services.


So as versions of NAV got changed configuring NAS service also became easy.

1.     Configuring NAS in NAV 2009 and 2013.

To do this you should have Application server manager for microsoft dynamics nav. 

Go to start, search for Application server manager for microsoft dynamics nav.
If you don't find any, 

Then go to your DVD installer of NAV run the setup file.
Select Add or remove components as shown below.


Select Application server and choose run from my computer in the drop down.

Once done, click next and wait until installation is successful.
Now you have Application server installed in your machine.
Go to your local services by searching in start button for services or by just clicking in Run prompt for services.msc. You will see the service installed as shown below.
Logon with your domain account instead of Network service.
Right click on below mentioned server, properties – Logon - > enter your system login id and password.



Now in your start menu, open Application server manager for Microsoft Dynamics NAV.
Right click on application server – select new application server.

Provide the host name – local host
Service name – BHEESHMA-SQL (the name which is displayed in the above marked service.

A new node will be created. Just click on this node and enter details of the server you are using, the database name and company.
To setup job queue the parameter should be JOBQUEUE as described below.


Click on Start the service.
You can check for the active sessions that are running in your machine by running the system table active sessions.
In your NAV development environment go to Database information and select current sessions.
There you must be able to see the new sessions configured as shown in below fig.



Once you verify that NAS service is running start configuring a job queue.


How Job queue works in NAV 2015. 

I explained how to do setup in NAv 2009. In NAV 2015 its pretty easy jus go to your server instance and go to NAS services and give the codeunit and starting method you need to run.

1. To schedule a job queue in NAV 2015 same applies in NAV 2009 R2. In your RTC client, go to Job queue entries click on new.
Choose the report or the codeunit you need to run.


I've given No. of minutes between run as 1 which means for every one minute the report will be run automatically without user interface between the start and end time.

In the above example I've took General Journal - Test report. I have filled the data as shown in above fig. 

Now click on Set status to ready so that now it is ready for job queue. 

2. To run a job queue, go to Job queue card and in NAS Settings, specify  NAS computer  your are using and NAS instance. 
once its done click on start job queue. 

you will get the following warning message.

Start the NAS service.
Once you are done with above steps. The NAS server will internally run the codeunit or the report you mentioned automatically from the specified time.

If it has to be repeated everyday at some specified time. Then mention the date and time it should run in Job Queue Entries page and go to Recurrence fast tab and then select the day and time the codeunit/report should run automatically.




An Overview of Journal Template, Journal Batch and Journal Line

Journal Template :
They provide Journal structure and default information for journal batches.

Journal Templates are located in Journal Template page.


Definiton of Journal Template contains a series of attributes such as,


1. Name

2. Description
3. Type
4. Recurring
5. No. Series

Journal Template has relevant attributes that define nature and behavior of journal templates,


Journal Template Table field: Defines the Description of Journal


Test Report ID: Simulate the posting process

ex: General Journal as the associated test report named General Journal - Test

Posting Report ID: This report is printed when the user selects post and print.


Page ID: Some journal may require UI objects.

Ex. General Journals which have a special page for bank and cash.

Source code: Here you can enter trail code for all posting documents which are done through this  journal.


Recurring: Whenever you post lines from a recurring journal, new lines are automatically created with a posting date defined in the recurring date formula.


Each journal template defines a default value of those attributes. The values that are defined in a template will be inherited by the journal batches which will be further inherited by journal Line.


Journal Batch: Journal batches usually serve to lines created by 2 different users called group journal lines.


They're created with the help of journal templates.



A journal batch is typically used to make a distinction between collections of logically grouped journal lines. A typical design is to have a journal batch for each user who enters lines. The batches are used during the posting process, in order to post one or multiple lines at once.

As shown in fig. The batch we have used is CASH for posting process to post that particulat line.



Journal Lines: Journal line will temporarily hold the transaction data until it is posted.

Until posting, Journal lines will be in draft state, means you can do correction/deletion o data.
Once the entry is posted line entries in journal are converted to Ledger Entries.





Journal lines contain the actual business data (posting dates, account numbers, amounts) that will be posted as ledger entries.

During posting, only the information from the journal lines is needed. However, the information has been created with the help of the journal templates and grouped together using the journal batches.
Posting creates ledger entries from the temporary content that is stored in the journal lines. Ledger entries are not created directly. Instead, they are posted from journal lines.
reference from community of dynamics.


In this, journal templates and batch is used if we need to create and post one or more entries. So, they're implemented in multiple areas of application like sales, purchases, cash receipts, payments, fixed assets.


Aggregation


There is a 1:n aggregation relationship between journal templates and journal batches, as well as between journal batches and journal lines. Deleting a template will cascade deletion of the related batches and lines. Deleting a batch will cascade into deletion of related lines.

Recurring Journals

A recurring journal is used to post transactions that repeat periodically. In a recurring journal, the user enters only the variable data, such as posting date, amounts, and accounts to be used for posting.
After posting a recurring journal, new journal lines are created containing the posting date for the next recurring period. The posting date recurrence pattern is previously defined in the Recurring Frequency field (for example, monthly recurrences(salary of an employee) are defined with the date formula 1M).
A boolean field named Recurring is placed on both the journal templates and journal batches, giving the possibility of defining the type of the journal to be used.

Standard Guidelines respected to navigation:



To keep a consistent user interface experience, it is recommended that the the following guidelines are taken respected concerning navigation:
  • Journal template to journal batches:
  • On the Journal Templates page, create an action called "Batches" and place it in the Navigate tab of the ribbon. Link the action to the batches list page.


fig shows batch action created and as been linked to batches list page. 

  • Journal batch to journal lines:
  • On the Batch page, create an action called "Edit Journal" in the Home ribbon tab.Link the action to the journal lines list page.




The action as been linked to journal lines through code.

In EditJournal - OnAction() trigger

GenJnlManagement.TemplateSelectionFromBatch(Rec);

Go to definiton of TemplateSelectionFromBatch(Rec) function and there you can see General journal lines as been called through code as shown below.



To keep a consistent user interface experience, it is recommended that the the following guidelines are taken respected concerning posting:
  • Posting multiple batches
  • On the Journal Batches page, posting actions (Post, Post and Print) are available. When invoked, the batch posting will iterate through all related journal lines and trigger the posting routine for all of the lines.



General Journals

The General Journal Templates page (101) uses the Gen. Journal Template table (80).
Various template types are defined: General,Sales,Purchases,Cash Receipts,Payments,Assets,Intercompany,Jobs. Based on the journal type, two other attributes are automatically set on the template lines as follows:
  • Page ID: Defines which journal page relates to the current journal template
  • Source Code: Filled with the default codes that are defined in Source Code Setup table (242).
The General Journals Batches page (251) is linked to the Gen. Journal Batch source table (232), which has a multiple-to-1 relationship with Gen. Journal Template table, based on the Journal Template Name field.
Some of the fields in the Gen. Journal Batch table are not editable. Instead, their value is automatically calculated from the parent Gen. Journal Template table. For example, the Recurring field (22) is a FlowField with the following calculation formula:
Lookup("Gen. Journal Template".Recurring WHERE (Name=FIELD(Journal Template Name)))
Similarly, the Template Type field is a FlowField that gets its value from the parent table:
Lookup("Gen. Journal Template".Type WHERE (Name=FIELD(Journal Template Name)))

Setting up a New Batch

When the user creates a new batch, the following field values are transferred from the Gen. Journal Template table to the Gen. Journal Batch table:
"Bal. Account Type" := GenJnlTemplate."Bal. Account Type";
"Bal. Account No." := GenJnlTemplate."Bal. Account No.";
"No. Series" := GenJnlTemplate."No. Series";
"Posting No. Series" := GenJnlTemplate."Posting No. Series";
"Reason Code" := GenJnlTemplate."Reason Code";
"Copy VAT Setup to Jnl. Lines" := GenJnlTemplate."Copy VAT Setup to Jnl. Lines";
"Allow VAT Difference" := GenJnlTemplate."Allow VAT Difference";

Cascade record deletion

When a record from the Gen. Journal Template table is deleted, the corresponding Gen. Journal Batch and Gen. Journal Line records are also deleted.

Cascade updates

When the reason code or the posting number series change in the current batch, all linked Gen. Journal Line records are updated (see ModifyLines function on the Gen. Journal Batch table).
The Gen. Journal Line table (814) stores a relation with the Journal Batch Name field (51) in the Gen. Journal Batch table. The Gen. Journal Line table also inherits the table relation with the Journal Template Name field (1) in the Gen. Journal Template table.

NAV Usages

Implementations of this pattern in NAV include:
  • General Journal 
  • Item Journal
  • Resource Journal
  • Job Journal

Reference from community.dynamics.com

2026 Release Wave 1(28.0) Major Update in Business Central That Actually Help Clients

This release is not about “new screens.”  It’s about running the business with fewer surprises and more confidence. 1. Smarter Work with C...