Posts

Showing posts from September, 2022

Using Postman for Automated Testing

Image
Introduction While using Business Central Web Services or APIs, we often use POSTMAN for testing the request and the responses. Today we’ll see how we can automate this testing to a certain extent using the inbuilt features of POSTMAN. We can have testing logic that runs before every request, after every request or logic that tests on particular request. In the below demonstration, we’ll write automated test to check for GET, PUT, POST and DELETE operations for a single record on a custom API. Postman itself provides a bunch of standard procedures or boiler plate code which we can modify as per our requirements. As this uses Javascript we can also use additional JS features here. Pre-requisites Account in Postman Business Central OnCloud/OnPrem Configuration POST Request So first we are going to be creating a record in the Customer Table with the following fields. One of the common things to be testing with Custom APIs is to verify whether the request is being created successfully (1) ...

Block Items on POS

Image
Introduction LS Central has its own unique way of preventing Items from being sold which is different from the standard “Blocked” option field we get on the Item Card. It also comes with detailed and refined permissions which can fit most business needs. All of this is done using another related table known as “Item Status” Pre-requisites Business Central OnCloud/OnPrem LS Central v16 References LS Retail Documentation How to block Items from POS Configuration Open the Retail Item Card for the Item you want to block. Open the “Item Status” for that Item. Click on the “Status Code” and Click on “Select from full list” Create a new record with code “BLOCKED” and enable all the fields. Here, you can see all the detailed controls available. Conclusion Thus, we saw how we can Block Items on POS in LS Central and other finer controls available at our disposal in LS Central. Happy Coding!

Use Dialogs to enhance User Experience

Image
Introduction We’ve all faced situations where we’ve had an operation take a long while which made the User wonder whether the system is stuck with something or is still processing. We can use simple dialogs which can enhance the User experience by showing User the progress of the operation. Some Business Central operations have out of the box dialogs which indicate progress like Posting documents or entries, Running reports with large data sets. Pre-requisites Business Central OnCloud/OnPrem References Dialog Data Type Configuration While using the Dialog for creating windows, there are 3 procedures that we are going to be using. Open - It creates the window which we will be displaying the messages in. Update - It updates the content of the window based on the values that we pass in it. Close - It closes the window. We can create a simple Progress Window using the below piece of code. And this is the result for it. Please note that because there were two # in the Label, system has b...

Using Task Scheduler in Business Central

Image
Introduction In Business Central, we can use Task Schedulers to use background processing to ensure that Users are not bothered with long operations. Task Scheduler provides us an easy to use and monitor way to offload tasks from the main thread. It creates separate sessions for processing and it allows creating multiple sessions which can be used to run tasks in parallel. It also allows us to define the company in which the processing will happening which is useful when we have to perform operations across all available companies, for instance initialization of certain fields or creation of certain records on application installation. Pre-requisites Business Central OnCloud or OnPremise References Task Scheduler Data Type Task Scheduler Configuration The following procedures are available for the Task Scheduler data type: CanCreateTask() - Checks whether it is possible to create a new task in this session. CreateTask() - Creates a new task with the specified codeunit, we also specif...

Using Enhanced Mailing Functionality in Business Central

Image
Introduction With SMTP Mail being deprecated, Business Central now provides us with a new and enhanced way for writing custom logic to send emails. To use this new functionality you have to first configure Email Accounts in Business Central, which you can find here . Pre-requisites Business Central v20 References Developing with enhanced mail feature Configuration The new method uses the Email Message (ID: 8904) and Email (ID: 8901) Codeunits.  I’ve added multiple actions below and I’ll be describing what the expected behaviour is. This is the simple piece of code which sends an email with the specified Recipients, CCs and BCCs. We can specify multiple recipients and dynamically as the lists are not bound by size. We can also call a simpler version of this method, where we don’t need to specify the CC and BCC. Using the OpenInEditor procedure of Email codeunit causes a page to be opened up where you can edit the message before you send it. You can also add attachments or you can sa...

POS Data Tables

Image
Introduction POS Data Tables are used to display data from any table in POS. The default POS Screen that we see where we enter our items for sale also consists of a Data Table. Data Tables are also used with Lookups, Record Zooms and Data Grids. In this blog, we are going to create our own POS Data Table using the Customer Table. Pre-requisites Microsoft Dynamics 365 Business Central LS Central References LS Documentation - POS Data Tables LS Documentation - Fixed Filter, POS Data Table Columns LS Documentation - Special Field Type, POS Data Table Columns Configuration The most important fields in the General Tab are: Field Description Table No. Specify the ID of the Table, whose data this Data Table will be showing on POS. Table Columns Specifies the col...

Using Custom POS Commands in LS Central

Image
Introduction LS Central provides an easy way to add Custom functionality through the use of POS External Commands. These commands are executed on the POS and let me know you how to create them. For this example, we will create a POS Command, to remove all the lines from the current transaction. Pre-requisites Microsoft Dynamics 365 Business Central On Premise LS Central V16 Configuration You will need a Codeunit in which we define all the custom commands, all your Custom commands can be added in a single Codeunit. Make sure to set the “TableNo” property to “POS Menu Line” table. In the OnRun trigger, we have to handle two cases:Registering the module and other commands Procedure to execute when command is called. For handling the first case, we create a procedure “Register” which takes a “POS Menu Line” as a parameter. In this procedure we use the “POS Command Registration” codeunit to register this module and all the associated commands. I prefer to use Global Labels to store the Modu...