Tag Archives: Business Central
Item Availability Overview – A quick glance at the Item’s Inventory levels
While going through some sales documents, I noticed that the page that appears when I click on “Show Details” in the notification for low inventory has been updated! When we click on “Show Details” now, we’re taken to the page named “Item Availability Check”. Furthermore, it includes options to directly create a Purchase Order or a Purchase Invoice from this page. If a Vendor is specified in the “Vendor No.” field of the Item Card, the Purchase Order/Invoice is automatically generated with that Vendor. In the scenario where multiple vendors are selected in the Item Vendor Catalog instead of the Vendor No., all the vendors are displayed, and the one selected by the user is utilized to create the Purchase Order/Invoice. In both cases, the Purchase Line will reflect the shortfall as the Quantity. If the Item has any substitutes available then the “Substitute Exists” indicates the same and clicking on it opens the Item Substitutions page. Further, if you click on the “All Locations” then the “Item Availability by Location” page is opened. That’s all! Just wanted to share something new I learned recently. We hope you found this article useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfronts.com
Actionable Error Messages in Business Central
Introduction Error handling is an important concept in every technical field. It helps programs deal with unexpected problems and mistakes smoothly. It makes sure software works reliably and doesn’t crash unexpectedly. Error handling also helps developers find and fix issues quickly, making the software better for users. Plus, it gives users clear messages when something goes wrong, making their experience smoother. It shows that the team has considered the scenario and has measures in place for it indicating a well designed solution. Microsoft has an amazing document which lists the things to keep in mind for writing resilient code. In Business Central, we have try functions to handle errors and error function to show those errors to the Users. In this blog, we’ll learn how we can enhance the error messages so that the Users can resolve the errors themselves or at the very least we can point them towards where the error is. Pre-requisites Business Central OnPrem/Cloud References Actionable errors Try Methods for Error Handling Robust Coding Practises Error Info – Business Central Docs Explanation Before we get to the code, let’s set a little context. For Error Handling, Microsoft has two categories in Business Central, ErrorInfo is a data type used for error handling and reporting. It can be used to hold information about errors that occur during the execution of code. It has additional properties and actions that can be used to define it’s behavior to the end-user. The ones that are most useful as – The “Add Action” procedure takes a codeunit and a method name as input. To pass input into this procedure, we add an “ErrorInfo” object as a parameter to the function and if we want to specify some details of the record where the error is happening or where the fix is to happen, we can use the following procedures. The “Add Navigation Action” only takes a method name as an input. So, to tell the action which page and which record to open we have the following procedures. If you are passing the Page No. and System Id to the procedure which handles the error then the same can be accessed there as well. Code Here, I’ve taken a sample scenario where the value of one field depends on the value of another field on the Sales Order. Basically ;- I’ve set it up so that these validations are triggered when the Sales Order is posted. And the same thing goes for the “Not Blank” scenario so I’m not writing it for now. So, if I try the second scenario where Type is “Blank” and Field has some value then we get the following error message. If I click on the “Copy Details” I can see the detailed message that I added for this Error Info. If I click on the “Make Mandatory Field Blank” action then I can make the “Some Important Field” as blank. The code behind the action – “Make Mandatory Field Blank” is as follows- I’ve used messages to confirm that the values that I passed during the origin of the error are flowing into the procedure. Here are the messages – Now, some of you might be wondering, if this was a error message where one field was dependent on another then it should’ve been a validation. And yes! That is correct and here is how it would look. Here, I’ve used both “Add Action” and “Add Navigation Action” on the ErrorInfo. For the Parameters, all of the parameters are pointing to the Customer. This opens the Customer Card for the specified Customer. Conclusion You can refer the “Actionable Errors” documentation for the best practises and patterns for which type of actionable error to use and where to use it. Thus, we learned how to utilize actions within error messages in Business Central to assist users in resolving errors more effectively. We hope you found this article useful and if you would like to discuss anything you can reach out to us at transform@cloudfronts.com.
Use Database Access Intent List to Boost Performance in Business Central
Introduction For any Business Application, database replication is a necessity for the application to be highly available, fault tolerant and performant without any data throughput issues. Business Central too follows the database replication utilizing a technique known as “Read Scale Out” or “Leader/Follower or Master/Slave Replication Architecture”. Basically, the business operations(Codeunits, Pages, POST/PUT/DELETE API calls) which create the data in the system are relatively quick as compared to Analytical operations (Reports, Queries, GET APIs calls)which read a whole bunch of data from a lot of tables at once. So, in this case, performing both business and analytical operations on the same database can cause performance issues as tables can be locked by an analytical operation while a business operation tries or access or modify that data. A solution for this is using multiple copies of the database in a leader follower architecture.All the write transactions are directed towards the leader database which are then forwarded to the follower databases.All the read transactions can be forwarded to either the leader or the follower database. Please note that this all only happens for Production Environments. Sandbox environments only have the primary database. Side Note If you’re wondering what happens when a User tries to read from a follower database before the leader database was able to send the updated information there (This is called a stale replica). This is an accepted risk when using this architecture. According to CAP Theorem only two of the three properties, Consistency, Availability and Partition Tolerance can be guaranteed. Out of these, partition tolerance has to be tolerated as network failures are inevitable so most systems have to choose between Consistency and Availability. In most cases, RDBMS systems choose Consistency over Availability (as does Business Central) and most NoSQL databases choose Availability over Consistency. Pre-requisites Business Central Cloud/OnPrem References Explanation Setting the property DataAccessIntent to ReadOnly doesn’t guarantee that all the operations that a particular object does are going to be routed via the “replica database”. For example, consider a case where we are using a processing report to update a field on the Item table based on the calculations done using a Query object. Here, when the operation started, given that the processing report intents to update the Item table, the operation was forwarded into the Primary database, now when the Query is executed to fetch the generate the necessary value, the database is still going to be the Primary database. To summarize, the database is not switched in the middle of a transaction. For API Pages where we are only going to be fetching the data from Business Central, we have to set the API page’s Editable property as false and only then we can set the DataAccessIntent to ReadOnly.We don’t have this property for any other page types. For Reports, we can set the DataAccessIntent property directly and if it is a processing report that tries to make any modifications to the data then we end up with a run-time error. For Queries, we can set the DataAccessIntent property directly as well with the same conditions as the Report object but in effect, the only time queries benefit from the “replica database” is if they are used directly as APIs. Almost all the ODATA GET requests are directed to the “replica” database by default in Business Central on Cloud. In the On-Premise Environment, we have a setting “ODataReadonlyGetEnabled” that controls this behaviour. Further, there is a list page in Business Central “Data Access Intent List” which can be used to modify the Data Access List of any Page, Query or Report object. The Default Value indicates that the object should use the pre-defined value defined in AL. The same rules as above are followed when we update the “Data Access Intent” values in the Data Access Intent List page. Conclusion: Thus we saw how Business Central architecture uses the “read scale out” method to ensure consistency and availability and how we can leverage those to boost our application’s performance. Happy Coding!
Setting Up Business Central On-Premise (BC-230) on a Virtual Machine
Introduction: Microsoft Dynamics 365 Business Central (formerly known as Microsoft Dynamics NAV) is a comprehensive business management solution that helps organizations streamline their financials, supply chain, sales, and customer service processes. It offers robust features for managing various aspects of your business, from inventory control to financial reporting. In this blog post, we’ll focus on the steps to download and install Business Central on-premises within a virtual machine. Whether you’re a developer, IT administrator, or business user, understanding this process is essential for setting up a local environment to explore and work with Business Central. Pre-requisites: Steps: 2. Choose the region for the business central 3. Extract the downloaded file. 4. Go to the extracted file and click on setup. 5. Choose Advanced Installation Options -> Choose an Installation Option -> Custom. 6. Make all the listed components available (Run from My Computer) or (Run all from My Computer). 7. Make the necessary changes. 8. Go to Azure Portal and assign the DNS Name in Azure Portal. 9. After the successfully installation, go to Windows PowerShell ISE -> “Run as Administrator” and execute the below commands line by line. Set-ExecutionPolicy unrestricted -Force Import-Module ‘C:\Program Files\Microsoft Dynamics 365 Business Central\230\Service\NavAdminTool.ps1’; Get-NAVServerConfiguration -ServerInstance BC230 Set-NAVServerConfiguration -KeyName EnableDebugging -KeyValue true Set-NAVServerConfiguration -KeyName DeveloperServicesEnabled -KeyValue true Restart-NAVServerInstance -ServerInstance BC230 Get-NAVServerUser BC230 Set-NavServerUser -Company ‘CRONUS International Ltd.’ Note: Upon executing the New-SelfAssingedCertificate command, a Thumbprint will be generated. Please retain the thumbprint ID for your reference. New-SelfSignedCertificate -DnsName “www.shubhazure.eastus.cloudapp.azure.com” -CertStoreLocation “Cert:\LocalMachine\My” 10. After creation/installation of Certificate, Go to Manage Computer Certificates > right-click on the Certificate > All Tasks>Manage Private Keys > Add NETWORK SERVICE and allow access to all the users and copy the certificate to Enterprise Trust, Trusted People, Trusted Publisher and Trust Devices folder. 11. Go to IIS Manager in that BC230 -> click on Browse “:8080 (http)”. 12. Change Credential Type and Add Thumbprint Set-NAVServerConfiguration -KeyName ServicesCertificateThumbprint -KeyValue Set-NAVServerConfiguration -KeyName ClientServicesCredentialType -KeyValue NavUserPassword 13. Change the Credential Type in navsettings.json file: This tells Business Central Clients to change the CredentialTypes for the Client. Goto C:\inetpub\wwwroot\<WEB SERVER INSTANCE>\navsettings.json 14. Go to Users in Business Central, insert the Password: 15. Binding your Web Server Instance with SSL / Self-Signed Certificate in IIS: 16. Restart the Server Instance in Business Central Administration and Webserver instance in IIS. Result After inserting the credentials, you will get access to Business Central. Conclusion Thus, in this blog we saw how to download Business Central (BC230) on Virtual Machine. We hope you found this article useful and if you would like to discuss anything you can reach out to us at transform@cloudfonts.com.
Using Notifications in Business Central via AL
Introduction Notifications in Business Central are alerts that appears in the Notification bar based on User actions. Notifications stack up from top to bottom, lasting until the user dismisses them, including those from sub-pages. Validation errors are prioritized and shown before other notifications. We can use this to alert the user regarding something without taking all the user’s notification towards it, in the way messages or errors do. They also have the option to allow Users to make a corrective action by embedding the action button directly into the notification. Let’s see how it works. Source Code Pre-requisites Business Central OnPrem/Cloud. References Notification – Business Central Docs Configuration Here, for an example, I’ve created one simple page which takes two inputs. 1. The message that is to be shown in the notification. 2. The message to be shown after the User clicks on the action embedded in the notification. And I have two actions which I’ll be using to show/hide the notification itself. Both of those combined result in a page like below – Now, here is the list of procedures that are available with a “Notification” variable. Let us walk through these one by one. Message – Specifies the content of the notification that appears in the UI. The message function is what we use to decide what the notification will say. I set up a global variable (Message) on my page so the user can type in a value directly, and that value will appear in the message. Scope – Specifies the scope in which the notification appears. According to Microsoft Docs, it is meant to specify the context in which the Notification appears. However for now, we only have the “Local Scope” available as an option so can’t comment much on this. Send – Sends the notification to be displayed by the client. Send is the function used to actually trigger the Notification in the UI. It returns a boolean value indicating whether the notification was triggered successfully or not. Set Data – Sets a data property value for the notification.Get Data – Gets a data property value from the notification.Has Data – Returns a boolean value indicating whether the notification has that value. These three functions work similar to a dictionaries Get, Set or Has functions. As Notifications can be used to perform actions, we need to store some data in them. This data is stored using key value pairs using the “Set Data” function. Then later we can retrieve it back using the “Get Data” function by passing in the specific key. However, if the Key does not exist, we get a run-time error, thus we can use the “Has Data” function to check whether our notification has the specified key. Please note that the data in the Notification is stored till the User dismisses the notification or exits from the page. Add Action – Adds an action on the notification. Here, in the “Show Notification” action, I have added the “Set Data” function to store the data within the global variable “MyData” into the notification with a key as “MyData” as well. Then, we call the “Add Action” function the following parameters In the “Notification Action” codeunit i’ve created a simple procedure which checks, gets and then messages out the value set in the “MyData” key. And so, we get the following output when we click on the action button on the notification. When we click on the action button, the notification automatically disappears. Recall – Recalls a sent notification. However, if we want to manually recall a notification, we can use the “Recall” procedure. After I click the “Hide Notification” button. Id – Gets or Sets the GUID ID for an individual notification. We can use the ID function to Get to Set the ID for a particular notification. We can use this in conjunction with the other functions by passing the ID of one notification and using that to get the data from that notification instead of passing the Notification variable itself. Here I’ve made some changes to the “Show Notification” action such that now it pops up two notifications instead of one and I am storing the ID of the second notification. This is the output. Now, here is the “Hide Notification” action which will be using the ID saved from earlier to recall just the copy notification. And this is the output. Conclusion Thus, we saw how we can use notification to provide non-intrusive alerts to the User along with actions. Happy Coding!
Tenant Creation and User Permissions for Business Central using Azure Portal
Introduction: Creating a tenant in Microsoft Entra-ID or Azure Active Directory (AAD) is a simple process that can be accomplished through the Azure portal. The portal serves as a centralized hub for managing Azure Active Directory and executing various administrative tasks, including the creation of a new tenant. Additionally, this blog will cover how to create a user and grant them permissions. Pre-requisites: Steps: Sign in to Azure Portal. Navigate to Microsoft Entra ID tenants: Select “Create”: Choose the type of tenant: On the Basics tab, select the type of tenant you want to create: Click Next: Configuration to proceed. Provide the necessary information: Organization name: Type your desired organization name (e.g., “Cloudfronts”). Initial domain name: Choose an initial domain name (e.g., “cfblogs”). Country/Region: Select your desired country or leave it as the United States. Review and create: Your new tenant is created: Check your user account: User can change their User Principal Name (which is generated by the system) by clicking on user e.g. “Shubham Prajapati” Now Sign in to Business Central Business Central Sign In | Microsoft Dynamics 365 Now put the User principal name As password was not set during tenant creation. Go to > Forgot Password After setting up the password you can successfully login to your Business Central Now Go to Settings > Admin Center Now Click on Upper Left Corner > Admin Go to Active Users > Click on the user which you want to give permission to access central, then go to Licenses and apps and select Licenses > Save changes Once permission is provided Go to Users page in business central and click on Update users from Microsoft Now the user is being updated, to give environment permission click on the user whom you want to give permission To give environment permission to user click on New Line > Select appropriate permission to user Conclusion Thus, in this blog we saw how to create a tenant for business central and how to add users and give permissions to them. Thank you for reading hope this helps!
Transfer Environment in Business Central
Introduction: The Transfer Environment feature in Microsoft Dynamics 365 Business Central allows you to seamlessly move an environment from one Microsoft Entra tenant to another. Here are the key points: Purpose: Self-Service Process: Steps: This streamlined process enhances flexibility and efficiency for managing Business Central environments across different tenants. Pre-requisites: Steps: 2. We are going to transfer “Shubham” to different tenant. Click on “Environment Transfers” 3. Go to Transfer Environment. 4. Select the environment that you are going to transfer and enter the Destination Tenant id. It is also possible to schedule the transfer within 2 weeks and set the time when it should be transferred. 5. Now go to Destination Environment > Admin Center. 6. Click on Environment Transfer > Receive Environment. 7. Enter the Source Tenant id (source from where the environment is to be send). Click on Next. 8. After that in Pending Incoming transfers the Environment will be displayed. Now just click on the Environment and Confirm. 9. The Environment is being successfully transferred. Note: If the destination tenant already has 1 Production environment and 3 Sandboxes, environment transfer is not possible. For successful transfer, the destination tenant must have no existing production environments (if you are transferring a production environment) or fewer than 3 sandboxes (if you are transferring sandbox). Conclusion: In conclusion, this blog has provided valuable insights about how to transfer environment in business central. Thank you very much for reading. I hope this helps!
Restoring an Environment in Business Central.
Introduction: This comprehensive guide provides administrators with a step-by-step process for restoring Microsoft Dynamics 365 Business Central environments to a previous state within the retention period. Users with Restore Permissions: Only specific users, such as internal and delegated administrators, can restore environments. These users must also have the D365 BACKUP/RESTORE permission set in the relevant environment. Considerations and Limitations: Environments can be restored up to 10 times per calendar month. Restoration is limited to the same Azure region and country as the original environment. Preparation before Restoration: Before restoring an environment, it’s essential to communicate the plan within the organization, restrict user access, and consider renaming the environment to avoid conflicts. Restoration Process: 3. Click on Restore 4. In the restore environment window select date and time to which you want to restore the environment. 5. Select the type of environment such as sandbox or production. 6. Name for restored environment. 7. Click on restore. Important point: You can restore your production environment into a new production environment even if doing so results in exceeding your number of environments or database capacity quotas. You can however only exceed this quota by one extra production environment, regardless of how many production environments you have available for your subscription. This capability is provided as an exception, to ensure that you can always restore your production environment in critical situations. You must return within your quota within 30 days following the restore by either removing the original production environment or by purchasing an additional production environment. Once the data in the restored database meets your expectations, activate the users, initiate the work queues, and notify your organization that the environment is once again available for use and that the restoration procedure is now complete. Hope this helps!