Category Archives: Dynamics 365
Mastering Date Manipulation with CALCDATE in Microsoft Dynamics 365 Business Central
Microsoft Dynamics 365 Business Central provides a comprehensive suite of tools designed to streamline business processes, and one of the most powerful tools for managing dates and times is the CALCDATE function. This versatile function enables users to perform complex date calculations with ease, making it indispensable for developers, consultants, and power users. In this blog post, we’ll dive deep into the CALCDATE function, explain its syntax, and explore how you can leverage it in your Business Central environment. Understanding CALCDATE The CALCDATE function is used to calculate a new date based on a specific date expression and an optional reference date. It is particularly helpful in scenarios where you need to determine dates relative to a given point in time. This could include calculating due dates, forecasting future events, setting up recurring transactions, or determining any other date relative to the system’s current or a user-defined date. For example, if you need to find the first day of next month or calculate a due date based on the current date, CALCDATE can handle these tasks efficiently. Syntax of CALCDATE The syntax of the CALCDATE function is simple, but the power lies in how you use the date expressions to represent relative time periods. NewDate := System.CalcDate(DateExpression: Text [, Date: Date]) Parameters DateExpression (Type: Text): This is the key input to the function, where you specify the date you want to calculate. The date expression can represent a variety of time periods, ranging from days to weeks, months, quarters, and years. The expression is evaluated from left to right, and each subexpression is processed one at a time. The valid syntax for the date expression follows a set of rules: Subexpression: A date expression consists of one or more subexpressions, each of which may be prefixed with a + or – sign. The subexpression can specify a time unit (day, week, month, etc.) along with a number. Here’s the structure of a typical date expression: <Subexpression> = [<Sign>] <Term> <Sign> = + | – <Term> = <Number><Unit> | <Unit><Number> | <Prefix><Unit> Examples of valid date expressions: The calendar in Business Central starts on Monday and ends on Sunday, where Monday is considered weekday 1 and Sunday is weekday 7. An invalid date expression, such as specifying an incorrect syntax, will result in a runtime error. 2. [Optional] Date (Type: Date):This optional parameter is used to define the reference date. If you omit it, the system defaults to the current date. You can specify any date here, and CALCDATE will perform the calculation based on that reference date instead of the current system date. Return Value Example: pageextension 50103 CustomerPageExt1 extends “Customer Card” { trigger OnOpenPage() var StartDate: Date; EndDate: Date; FirstDateofPreviousMonth: Date; LastDateofPreviousMonth: Date; FirstDateofNextMonth: Date; LastDateofNextMonth: Date; TodayDate: Date; FirstDateofYear: Date; LastDateofYear: Date; FirstDayOfNextQuarter: Date; LastDayOfCurrentQuarter: Date; FirstDayOfNextWeek: Date; FirstDayOfNextWeek10D: Date; begin // Current Month Start and End Dates StartDate := System.CalcDate(‘<-CM>’, Today); EndDate := System.CalcDate(‘<CM>’, Today); // Previous Month Start and End Dates TodayDate := TODAY; FirstDateOfPreviousMonth := CALCDATE(‘<-1M>’, CALCDATE(‘<-CM>’, TodayDate)); LastDateOfPreviousMonth := CALCDATE(‘<-1M>’, CALCDATE(‘<CM>+1D’, TodayDate) – 1); // Next Month Start and End Dates FirstDateOfNextMonth := CALCDATE(‘<+1M>’, CALCDATE(‘<-CM>’, TodayDate)); LastDateOfNextMonth := CALCDATE(‘<+1M>’, CALCDATE(‘<CM>+1D’, TodayDate) – 1); // First and Last Date of the Current Year FirstDateofYear := CALCDATE(‘<-CY>’, TodayDate); LastDateOfYear := CALCDATE(‘<CY>’, TODAY); // First Day of the Next Quarter FirstDayOfNextQuarter := CALCDATE(‘<+1Q>’, CALCDATE(‘<-CQ>’, TodayDate)); // Last Day of the Current Quarter LastDayOfCurrentQuarter := CALCDATE(‘<CQ>’, TODAY); // First Day of the Next Week FirstDayOfNextWeek := CALCDATE(‘<+1W>’, CALCDATE(‘<-CW>’, TodayDate)); // First Day of the Next Week + 10D FirstDayOfNextWeek10D := CALCDATE(‘<+1W>+10D’, CALCDATE(‘<-CW>’, TodayDate)); Message( ‘Current Month: ‘ + ‘\’ + ‘Start Date: %1, End Date: %2’ + ‘\’ + ‘\’ + ‘Previous Month: ‘ + ‘\’ + ‘Start Date: %3, End Date: %4’ + ‘\’ + ‘\’ + ‘Next Month: ‘ + ‘\’ + ‘Start Date: %5, End Date: %6’ + ‘\’ + ‘\’ + ‘Current Year: ‘ + ‘\’ + ‘Start Date: %7, End Date: %8’ + ‘\’ + ‘\’ + ‘Next Quarter: ‘ + ‘\’ + ‘Start Date: %9’ + ‘\’ + ‘\’ + ‘Current Quarter: ‘ + ‘\’ + ‘End Date: %10’ + ‘\’ + ‘\’ + ‘Next Week: ‘ + ‘\’ + ‘Start Date: %11’ + ‘\’ + ‘\’ + ‘Next Week + 10D: ‘ + ‘\’ + ‘Start Date: %12’, StartDate, EndDate, FirstDateOfPreviousMonth, LastDateOfPreviousMonth, FirstDateOfNextMonth, LastDateOfNextMonth, FirstDateofYear, LastDateOfYear, FirstDayOfNextQuarter, LastDayOfCurrentQuarter, FirstDayOfNextWeek, FirstDayOfNextWeek10D ); end; } Why Use CALCDATE in Business Central? The CALCDATE function is incredibly useful for automating and simplifying date-based calculations in Microsoft Dynamics 365 Business Central. Whether you are calculating due dates, generating reports based on time periods, or working with recurring events, CALCDATE saves time and reduces the chances of errors by automating these calculations. Here are some scenarios where CALCDATE can be particularly useful: To conclude, the CALCDATE function is a vital tool for anyone working in Microsoft Dynamics 365 Business Central. It simplifies the process of calculating dates based on specific time intervals, allowing users to manage and manipulate time-based data with ease. By understanding its syntax and functionality, you can unlock the full potential of CALCDATE and streamline your business processes. If you’re a developer or power user, mastering the CALCDATE function will not only enhance your efficiency but also give you greater control over your business data and operations. We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.
Share Story :
A Guide to Batch and Serial Numbers in D365 F&O: Part 1
In today’s fast-moving world, keeping track of inventory is incredibly important for businesses of all types and sizes. Proper inventory tracking ensures that businesses can maintain product quality, comply with industry regulations, and deliver better customer experiences. Dynamics 365 Finance & Operations (D365F&O) offers powerful tools to simplify this process, including the use of batch and serial numbers. These features allow businesses to track and manage products accurately, from the time they are manufactured or received to when they reach the customer. Let’s take a closer look at what batch and serial numbers are, how they work in D365F&O, and why they are essential for efficient inventory management. What Are Batch and Serial Numbers? Batch Numbers: Batch numbers are unique identifiers used to group items that were manufactured or received under similar conditions, such as during the same production run or shipment. These numbers make it easier to track and manage items collectively. Batch numbers are particularly useful for businesses that deal with perishable goods or need to maintain strict quality control. For example: Serial Numbers: Serial numbers are unique codes assigned to individual items, allowing each product to be tracked separately. Unlike batch numbers, which apply to groups of items, serial numbers provide item-level traceability. This is especially important for businesses dealing with high-value or complex products. For example: How to Configure Batch and Serial Numbers in D365F&O D365F&O makes it simple to set up and manage batch and serial numbers, ensuring smooth inventory operations. Here’s how you can configure these features step by step: 1. Set Up Tracking Dimensions: 2.Assign Tracking Dimensions to Items: 3.Enable Automatic Numbering: 4.Test and Train: Why Are Batch and Serial Numbers Important? Batch and serial numbers play a crucial role in modern inventory management, offering a range of benefits that streamline operations and reduce risks. Some key advantages include: To conclude, this blog is Part 1 of our detailed guide on batch and serial numbers in D365F&O. We’ve explored what batch and serial numbers are, why they’re important, and how to set them up in the system. By implementing these features, businesses can improve traceability, enhance inventory accuracy, and ensure compliance with industry regulations. In the next part, we’ll take a practical look at how to use batch and serial numbers in day-to-day operations. This will include real-world examples, step-by-step processes, and screenshots to help you better understand how these features can streamline your inventory management. Stay tuned for more insights and practical tips to make the most of D365F&O’s powerful inventory tracking capabilities! That’s it for this blog. Hope this helps!! We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.
Share Story :
How to Use Security Role Sync in XrmToolbox
In this blog, we will explore the use of the XrmToolBox and different tools present in the store. XrmToolBox is free to use tool that connects with the Dataverse environment and provide you with various tools that allow performing heavy management task very easily. Many developers have contributed to XrmToolBox store by creating a tool/library which is beneficial in the regular development and management work of Dynamics 365 CRM Consultants/Developers. You can find the Installation and setup guidance from a website that you can follow as we directly going to start exploring different types of tools available. Home Page: https://www.xrmtoolbox.com/ Connection Setup with Dataverse Environment: https://www.xrmtoolbox.com/documentation/for-users/manage-connections/ Tool #1: “Security Role Sync” created by Bharath Sheelam The tool is created to sync the security roles between two users. I have two users present in the Dataverse environment and I have requirement to sync roles from one user to another. If we need to sync the roles from “Richie Jacob” to “Siddhi Patekar” so we need to select “Richie Jacob” in Source and “Siddhi Patekar” in Destination. Once you select the user and you need to click on Sync Security roles it will start syncing and notify you once it is completed. Use Case and Key Benefits: We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.
Share Story :
Data Flow with Array Filtering in Power Automate
When working with arrays in Power Automate, it’s common to need to filter or select a specific item based on certain attributes. Whether you’re handling JSON data from an API, processing records from a list, or managing dynamic content within a flow, efficiently identifying the right item is key. In this blog, we’ll explore a simple yet effective method to extract the desired item from an array using expressions in Power Automate. By the end, you’ll have a clear strategy to streamline your workflows and enhance the intelligence of your automation. In case you need to select an item from an array in Power Automate based on the value of a certain attribute, here’s how you can do it. Scenario You have an array of objects, and each object has a specific attribute. You want to efficiently select the object(s) where this attribute matches a particular value. As you see, the array of objects have different structure – All of them have an attribute called “key” and that’s the one you want to select and then process further. Let’s see how we do it. Filter Array Let’s see how you can select the item from the array based on the value of the “key” attribute instead of looping through all the items and matching. To encapsulate, by using this approach, you can efficiently select specific items from an array based on the value of a particular attribute, making your Power Automate flows more dynamic and tailored to your specific needs. We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.
Share Story :
XRM Toolbox: Tools in enhancing the Dynamics 365 Solutions for Developers
As a Dynamics 365 developer, I spend a lot of time customizing and extending the platform to fit the specific needs of my clients. While the built-in tools are powerful, there are times when you need something a little more…well, magical. That’s where the XRM Toolbox comes in. Think of the XRM Toolbox as a developer’s Swiss Army Knife. It’s a collection of free, open-source tools that can supercharge your productivity and make your life a whole lot easier. Let’s dive into some of my favorite functionalities: 1. WebResource Manager: Say Goodbye to Tedious File Management Managing web resources in Dynamics 365 can be a real pain. You’re constantly uploading, updating, and deleting files, and it’s easy to lose track of changes. The Web Resource Manager from MscrmTools is a game-changer. It provides a user-friendly interface for managing all your web resources in one place. No more wrestling with folders and file paths! This tool has saved me countless hours, and I can’t recommend it enough. 2. SiteMap Editor: Editing the Sitemap Without Breaking Everything The thought of editing a Dynamics 365 Sitemap directly in XML sends shivers down my spine. One wrong keystroke, and you could bring your entire CRM system to its knees. The SiteMap Editor from MscrmTools is a lifesaver. It allows you to visually edit your sitemap components, create and manage areas, and update properties like icons and titles. It’s like having a magic wand for your Sitemap woes! 3. Ribbon Workbench 2016: Effortless Ribbon Customization Customizing the Dynamics 365 ribbon used to be a complex and error-prone process that involved manually editing XML files. Thankfully, those days are over! The Ribbon Workbench by Scott Durow lets you edit the ribbon and command bar directly within the XrmToolbox. You can add buttons, menus, and custom commands with just a few clicks. It’s a fantastic tool that makes ribbon customization a breeze. 4. FetchXML Builder: Crafting Powerful Queries Without Breaking a Sweat FetchXML is a powerful language for querying data in Dynamics 365, but it can be tricky to master. The FetchXML Builder by Jonas Rapp is an invaluable tool that simplifies the process. It provides a user-friendly interface for building complex queries, including aggregates, outer joins, and even queries that can’t be created in Advanced Find. Plus, it can generate C# code and OData strings from your FetchXML, making it a true developer’s companion. 5. Metadata Document Generator: Documenting Your Data Like a Pro Documenting your Dynamics 365 data can be a time-consuming chore. The Metadata Document Generator from MscrmTools automates this process by generating Word and Excel documents that contain detailed information about your entities and attributes. No more manually creating tables and copying data – this tool does the heavy lifting for you. These are just a few of the many amazing tools available in the XRM Toolbox. With its extensive functionality and ever-growing collection of plugins, the XRM Toolbox is an essential part of any Dynamics 365 developer’s toolkit. It’s a treasure trove of time-saving utilities that can make your development experience smoother, faster, and more enjoyable. So, if you’re a Dynamics 365 developer who wants to work smarter, not harder, I highly recommend checking out the XRM Toolbox. You won’t be disappointed! We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.
Share Story :
Avoiding Negative Inventory: Tips and Tricks in D365 F&O
Managing inventory is an important part of any business, and keeping track of stock levels is key to smooth operations. Negative inventory happens when your system shows that you have less than zero items in stock. This can cause problems like delays, mistakes in finances, and unhappy customers. Luckily, Dynamics 365 Finance & Operations (D365F&O) has tools to help you avoid negative inventory. In this blog, we’ll share simple tips and tricks to keep your inventory accurate. What is Negative Inventory? Negative inventory means your system says you have less stock than zero. For example, if you sell or use more items than you have in storage, the system might show a negative number. This can happen because: Negative inventory can cause confusion, financial mistakes, and problems in planning and ordering stock. How to Avoid Negative Inventory in D365F&O Here are some easy steps to prevent negative inventory in D365F&O: 1. Set Up Item Model Groups Item model groups control how inventory is managed. Setting them up properly helps avoid negative inventory. 2. Use Inventory Reservations Inventory reservations make sure stock is set aside for specific orders, so you don’t overcommit. 3. Track Inventory Dimensions Inventory dimensions, like site, warehouse, batch, and serial number, help you track stock accurately. Make sure these are used correctly for each product. 4. Do Regular Cycle Counts Cycle counts help you check if the stock in your system matches what you actually have. Fixing any mistakes quickly avoids negative inventory. 5. Post Transactions in Order Posting transactions in the wrong order can cause temporary negative inventory. For example, issuing stock before recording receipts. 6. Check Inventory Transactions Often Review inventory transactions to catch and fix issues early. 7. Train Your Team Training your team is key to preventing mistakes that lead to negative inventory. Benefits of Avoiding Negative Inventory Preventing negative inventory can make a big difference for your business: Avoiding negative inventory in D365F&O is about using the right settings and following good processes. By setting up item model groups, using reservations, doing regular cycle counts, and keeping an eye on transactions, you can prevent negative inventory and keep your stock levels accurate. These steps will improve your operations, make customers happy, and help your business run smoothly. Start using these tips today to get the most out of Dynamics 365 Finance & Operations for inventory management! So, that its for this blog. Thanks for reading!! We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.
Share Story :
Resource Roles in Project Operations
Let’s delve into the concept of Resource Roles and how to incorporate them into your Price Lists. Understanding Resource Roles Resource Roles represent the specific functions or responsibilities assigned to individuals within a project. For example, “Project Manager,” “Software Engineer,” “Consultant,” “Marketing Specialist,” etc. These roles provide a structured framework for managing resources and defining their contributions to project deliverables. Accessing Resource Roles Let’s see how we can add Resource Roles – Add Role in Cost Price List Now, we want to assign a Cost Price to the Consulting Lead role (which is of type Chargeable). Let’s see below on how we can do this – Add Role in Sales Price List Let’s also add the same Consulting Lead role to the Sales Price List as well – We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.
Share Story :
Phases of Quality Control in Business Central – 2
In this continuation of our journey through the GMP-compliant quality control module in Business Central, we’ll be diving into key components that come into play post-MRP (Material Requirements Planning/Planning worksheet) run. The MRP identifies what’s required to meet demand, but ensuring that all materials align with quality standards demands a closer look at each phase—from defining specifications to the actual receipt of goods. This blog will cover four essential steps: setting up a Specification Master for Quality, creating a Purchase Indent to formalize demand, generating a Purchase Order to confirm procurement, and finally, processing the Goods Receipt Note (GRN), where quality checks ensure that only materials meeting specified standards are accepted. Each of these steps is integral in maintaining a seamless, controlled flow of materials that meet stringent quality requirements. Through these processes, we not only streamline procurement but also build quality control measures right into the purchasing workflow. Let’s explore how Business Central’s quality control module facilitates this alignment with Good Manufacturing Practices (GMP), helping to achieve a compliant, efficient supply chain. Specification Master In the Specifications Master is a centralized repository of quality parameters. It defines acceptance criteria for raw materials, intermediates, and finished products, ensuring compliance with regulatory standards and maintaining consistent product quality throughout procurement, production, and delivery processes. Purchase Indent Purchase indent can be created from the planning worksheet where system calculates the shortages. The EOPA no. which is tagged in the sales order will also be tagged against the shortage raw material in the planning worksheet. The quantity to purchase can be adjusted on purchase indent. Once necessary information is filled in, the purchase indent can be converted to purchase order. Multiple purchase order can be created from 1 purchase indent till the indent quantity is exhausted. Purchase Order In the purchase order page, location should be where the materials will be received. Let’s call it as quarantine. The locations will be according to the type of the material. Eg. If it is a raw material the location will be RM quarantine. While generating GRN, system creates the posted purchase receipt document and the inspection datasheet. (if the item is QC enabled) Inspection datasheet- It is a page where sampling is performed. The quality control process starts from the inspection datasheet page. Conclusion: Incorporating quality control in procurement ensures GMP compliance from the start. Business Central’s module streamlines this with defined specifications, structured purchasing, and enforced quality checks, creating a seamless and compliant supply chain. We will be continuing the quality control of purchased goods in the next blog. We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.
Share Story :
Correction of Inventory Cost
Inventory valuation is important for any manufacturing and trading business. The stakeholders would be Cost Accountants, CFOs and investors. Further, Inventory cost is the major budget element. Recently, we had a client raise the issue of cost price of inventory items not getting correctly calculated because of the following factors: Steps to be followed: 2. Go to Adjustment=>Fixed Price 3. It will show inventory transactions as per the selection criteria, with their quantity and cost price. 4. Click on Fixed Price and put the approved cost price per unit for the item variant.Click on the post button. 5. There will be a posting entry in Closing & Adjustment tab. 6. Run recalculation for the item as on the cost price date. 7. Review the Inventory Aging report or Inventory transaction report. The updated price must be reflected. 8. Recalculation can be run together after updating individual item’s cost price. 9. This must be done prior to the running inventory month close. Conclusion : This process should be an integral part of inventory valuation. Correct inventory valuation would ensure correct cost of goods sold (COGS), gross profit (GP) and cost value of asset in Balance Sheet. We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.
Share Story :
Error Handling Techniques in Dynamics 365 Plugins
Have You Ever Struggled with Debugging Errors in Dynamics 365 Plugins? If you’ve been working with Dynamics 365 plugins, you’ve likely encountered scenarios where your plugin failed unexpectedly. Debugging these failures can be a challenge, especially in production environments where attaching a debugger is not always an option. How do you ensure that errors are logged effectively? How do you prevent the plugin from breaking critical business processes? In this blog, I will walk you through the best error-handling techniques for Dynamics 365 plugins, ensuring that you can capture, log, and handle errors gracefully. Why Trust Me? As a Microsoft Certified Trainer and Dynamics 365 Consultant, I have extensive experience working with Dynamics 365 CRM, Power Platform, and Azure. Over the years, I have encountered and resolved numerous plugin errors in live environments. Through my blogs and speaking engagements, I have shared valuable insights on building robust and scalable solutions in Dynamics 365. This expertise allows me to provide you with practical and effective error-handling strategies that you can implement immediately. Understanding Plugin Execution and Error Scenarios Before diving into error handling techniques, let’s briefly understand the plugin execution model. Plugins in Dynamics 365 execute in the sandbox (isolated) mode or full-trust (non-isolated) mode and can be synchronous or asynchronous. Common error scenarios in plugins include: Now, let’s explore how to handle these errors effectively. 1.) Using Try-Catch Blocks for Exception Handling The simplest and most effective way to handle errors is by wrapping your plugin logic inside a try-catch block. Why This Works: 2.) Using ITracingService for Logging Dynamics 365 provides the ITracingService to log debug messages, which is particularly useful in sandboxed plugins where direct debugging is not possible. Benefits: 3.) Logging Errors to a Custom Entity For persistent logging, consider storing error details in a custom entity (e.g., Plugin Error Log). Why This Helps: 4. Using Secure Configuration for External API Calls If your plugin interacts with external APIs, store credentials in the secure configuration rather than hardcoding them. Benefits: 5. Handling Recursion and Infinite Loops Dynamics 365 allows detecting recursive plugin execution using Depth in IPluginExecutionContext. Why? Conclusion Error handling in Dynamics 365 plugins is crucial for maintaining stability and ensuring seamless business operations. By implementing try-catch blocks, using tracing services, logging errors to a custom entity, managing secure configurations, and handling recursion, you can build robust and maintainable plugins. I encourage you to apply these techniques to your plugins and explore additional monitoring tools like Application Insights for even better observability. Have you faced any plugin debugging challenges? Share your experiences in the comments below! We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.