Posts

Showing posts from 2023

Configuring NAS for Scheduled Jobs in LS Central

Image
Introduction LS Central Scheduler Jobs are used for automatic background processing. These jobs use the NAS Service under the hood. We are going to see how to configure the NAS Service for LS Central. Pre-requisites LS Central Data Director References https://help.lscentral.lsretail.com/Content/LS-Insight/Setup/LS-Central-In-Cloud-LS-Insight-In-Azure/3-Machine-Or-VM.htmxt Configuration Create a new Server Instance and name it appropriately. Ensure that the account for this new Server Instance is set to User and the User has Administrator privileges. In the General tab, update the “Service Default Company” and “Service Default Time Zone.” In the NAS Services tab, set the following fields:Run NAS Services with Admin Rights : True Startup Argument : NASID,TYPEFILTER=,LOG=1,REPEAT=1 Startup Codeunit : 99001468 Startup Method : LSRSCHEDULER Restart the Server Instance. Open the Scheduler Setup in LS Central and set the “Enable NAS Scheduler” to true. Refresh the page. Conclusion Thus, we sa...

Using Scheduled Jobs to Update POS Buffer

Image
Introduction POS Search Buffer is used to display the Items in the main POS Search Drop Down. The configuration for automatically updating the POS Search Buffer is located in the POS Functionality Profile, but it is limited in nature, only 2 options exist on the POS Functionality Profile, one which defines whether the buffer should be updated automatically and the other defines the frequency in which it should be updated. We’ve faced some issues with this process running automatically such the Buffer not being updated as such we had to look for a work-around using Scheduled Jobs. Pre-requisites LS Central Business Central OnPrem or OnCloud References How to: Control When to Update Search Index and POS Buffer (lsretail.com) Configuration Create a new scheduled job with an appropriate name and description. In the Object Setup, define the “Object Type” as Codeunit and “Object ID” as 10000749, set the “Code” field as INDEX. Also ensure that the “Uses Scheduler Job Record” is set to true. I...

Live Share With VS Code

Image
Introduction VS Code has a feature, Live Share, using which multiple people can access the same workspace in VS Code and modify files at the same time. This has huge applications in teaching, code reviews as well as prototyping. You can edit modify separate files at the same time in the same folder. Pre-requisites VS Code References Use Microsoft Live Share to collaborate with Visual Studio Code Configuration Install the Live Share extension in VS Code. Click on the “Live Share” button at the bottom left. Sign in using your Github or Microsoft Account. You can see the session details in the “Live Share” tab along with previously connected. Click on the “Invite Participants” to get the link what can be used to share the session. Now, you can collaborate with different Users and modify the same or different files together. Conclusion Thus we saw how we can use Live Share for collaborating while developing or reviewing in VS Code.  Happy Coding!

Navigation in Business Central APIs

Image
Introduction Business Central provides us a standard set of API pages which we can use for performing CRUD Operations on records. In addition to this it also provides us with “Containments” feature, which lets us fetch records related to a certain record. Pre-requisites Business Central onCloud or On-Premise. Postman (For Testing) References Using Containments and Associations - Business Central | Microsoft Docs Usage Go to Web Services. Click on Actions and download the Metadata for that Web Services. In case of the “Sales Order API”, the actual sub-page is named salesOrderLines, so the endpoint for Navigation would be {ParentServiceName}{SubPageName} which in this case would be salesOrderssalesOrderLines. We can see the same in the Metadata document as well. Use the following format for calling the Containment endpoint - salesOrders(Document ID)/salesOrderssalesOrderLines. This returns an array, which contains the list of that particular Sales Order’s Lines. You can create these asso...

Automated Detached Media Cleanup

Image
Introduction In Business Central, there are two ways to store files. Either as Blobs or as Media types. In Media types, we store the files in the database (Tenant Media ID - 2000000184) and then we refer this record in other tables. Whenever there are no records referring a Media, it is deleted from the database. Media types are much more performant as they support caching whereas BLOBs needs to be fetched from the SQL Server every time they are used. Microsoft has moved most of the fields from using Blobs to Media types. However, in scenarios with a high load of writes and deletes, it is possible that there may end up orphaned media records i.e. Media records that are not referenced anywhere. In order to tackle such cases, Microsoft has recently announced the FindOrphans procedure which would return a list of GUIDs of such orphaned Media Types which could then we dealt with as needed. There’s also another tool that has been provided by Microsoft which uses this newly added procedures ...

Reduce Storage Usage Using Data Administration in Business Central

Image
Introduction By default, Business Central comes with 80GB of storage capacity across three sandbox environments and 1 Production Environment with an additional 3GB/Premium License, 2GB/Essential License, 1GB/Device license. These storage limits depending on your business volume may run out if the data is not managed properly. Business Central now comes with a one stop view where you can manage (compress or delete) the entries to reduce storage usage - “Data Administration.” Pre-requisites Business Central Cloud/On Prem References Manage Storage by Deleting Documents or Compressing Data - Business Central | Microsoft Learn Configuration In Business Central, we have had the option to view the capacity usage from the Admin Center for a while now. Recently, they’ve also added a one stop view to check and manage the capacity usage - Data Administration. It can be found directly from the global search. The first time we open this we are greeted with an empty view, the data is loaded after we...

Attach Debugger to an Active Session

Image
Introduction Business Central has recently introduced the functionality to attach a debugger to an active User session. This was previously available in NAV however it has only recently become available for Business Central. Pre-requisites Business Central OnCloud/OnPrem References Attach AL Debugger - MS Docs Configuration To use this functionality, we simply need to create an entry in the launch.json file. The important properties here are the “sessionId” and the “request”. This works much faster than the traditional deploy and debug and really makes your life easier as a developer.   Also, I tried using it for a Production Environment and as expected it didn’t work. Snapshot debugging it is then! Conclusion Thus, we saw how we can attach a debugger to an active user session in Business Central.  Happy Coding!

Master Data Sync Across Companies

Image
Introduction In many business scenarios we have two or more companies which work with the same Customers or Vendors or has same data that is to be shared with multiple legal entities. For such cases, manually making sure everything is in sync becomes difficult as the number of entities increases. For this, Business Central now comes with the functionality to sync master data across multiple companies. This can also be used by consultants for one time syncs if they simply need the setups from one company in another instead of going through the Configuration Package route. Pre-requisites Business Central Cloud/OnPrem References Set up and sync master data across companies Set Up Companies to Synchronize Master Data - Business Central Configuration First, I’ve created two companies in a Sandbox Box which are going to have a uni-directional sync between them. It is possible to have a bi-directional sync however it may cause issues and may cause over-write of data if it isn’t configured pro...