D365 Archives -

Tag Archives: D365

Automating HTML Email Notifications in Microsoft Dynamics 365 Business Central

Introduction In this blog, we will explore how to create HTML-formatted email notifications in Microsoft Dynamics 365 Business Central using AL code. We will guide you through a practical example that sends an HTML email notification when a Posted Purchase Invoice is inserted. Pre-requisite – Microsoft Dynamics 365 Business Central (On-premises or Cloud) Objective Our goal is to automatically send an HTML email containing purchase order details whenever a new Purchase Invoice Header is created. Step-by-Step Implementation Before diving into the code, you need to set up the email functionality in Business Central to ensure the system can send emails. Step 1: Set Up Email in Business Central Open Business Central: – Sign in to your Business Central account. – Search for “Set Up Email” in the top-right search bar. Configure Email: – Choose SMTP as the email type and click “Next.” – Fill in the necessary details, such as the email account and authentication details, then click “Next” to finish the setup. – Set the email account as the default if you have multiple email addresses. Step 2: Create Necessary Fields in Table and Page Extensions Add a Field in Table Extension: – Create a boolean field named “GRN Notification” in the User Setup table extension. This field will ensure that the email is sent only to the users who require it. tableextension 51328 UserSetupExt extends “User Setup” {     fields     { field(55005; “GRN Notification”; Boolean)         {             DataClassification = CustomerContent;         }     } } Add a Field in Page Extension: – Add the “GRN Notification” field to the User Setup page extension to allow users to enable or disable notifications. pageextension50102 extends “User Setup” {     layout     { addafter(“Register Time”)           { field(“GRN Notification”; Rec.”GRN Notification”)                     {                         ApplicationArea = All;                     } }     } } Step 3: Create a Table Extension for the Purchase Invoice Header This is where we extend the Purch. Inv. Header table to trigger a procedure that sends the email when a new record is inserted. tableextension 50101 PurchaseInvoiceHeader extends “Purch. Inv. Header”{    trigger OnInsert()    begin        GRNPostingtoPO(Rec);    end; Step 4: Define the GRNPostingtoPO Procedure This procedure handles the core logic of the email notification:     procedure GRNPostingtoPO(PurchaseInvoiceHeader: Record “Purch. Inv. Header”)     var         UserSetup: Record “User Setup”;         EmailMessage: Codeunit “Email Message”;         Email: Codeunit “Email”;         PurchaseLine: Record “Purchase Line”;         PurchaseHeader: Record “Purchase Header”;         HtmlBody: Text;     begin         // Find the corresponding Purchase Header using the “Order No.”         PurchaseHeader.SetRange(“No.”, PurchaseInvoiceHeader.”Order No.”);        // If the Purchase Header exists, retrieve related Purchase Lines.         if PurchaseHeader.FindFirst() then begin             PurchaseLine.SetRange(“Document No.”, PurchaseHeader.”No.”);             if PurchaseLine.FindSet() then begin                 // Build the HTML email body with purchase order details.                 HtmlBody := ‘Hello Team,’ +                             ‘<p>Please find the attached purchase order details.</p>’ + ‘<BR>’ +                             ‘<p>Purchase Order has been created successfully.</p>’ +                             ‘<h3>Purchase Order No. ‘ + PurchaseInvoiceHeader.”No.” + ‘</h3>’ +                             ‘<table border=”1″ style=”border-collapse: collapse; width: 100%;”>’ +                             ‘<tr>’ +                             ‘<th style=”padding: 8px; text-align: left; background-color: #f2f2f2;”>IDS No.</th>’ +                             ‘<th style=”padding: 8px; text-align: left; background-color: #f2f2f2;”>ITEM No.</th>’ +                             ‘<th style=”padding: 8px; text-align: left; background-color: #f2f2f2;”>Item Description</th>’ +                             ‘<th style=”padding: 8px; text-align: left; background-color: #f2f2f2;”>Quantity</th>’ +                             ‘</tr>’;                 // Loop through the Purchase Lines to add them to the HTML body.                 repeat                     HtmlBody += ‘<tr>’ +                                 ‘<td style=”padding: 8px;”>’ + PurchaseLine.”Document No.” + ‘</td>’ +                                 ‘<td style=”padding: 8px;”>’ + PurchaseLine.”No.” + ‘</td>’ +                                 ‘<td style=”padding: 8px;”>’ + PurchaseLine.Description + ‘</td>’ +                                 ‘<td style=”padding: 8px;”>’ + Format(PurchaseLine.Quantity) + ‘</td>’ +                                 ‘</tr>’;                 until PurchaseLine.Next() = 0;                 // Close the HTML table and body.                 HtmlBody += ‘</table>’ +                             ‘<p>This is an Auto-generated mail, if any concerns related to purchase please contact the ERP Team.</p>’ +                             ‘</body></html>’;                 // Send the email to users who have GRN Notification enabled.                 UserSetup.SetRange(“GRN Notification”, true);                 if UserSetup.FindSet() then begin                     repeat                         EmailMessage.Create(                             UserSetup.”E-Mail”,                             ‘Purchase Order Posted’,                             HtmlBody,                             true                         );                         Email.Send(EmailMessage, Enum::”Email Scenario”::Default);                     until UserSetup.Next() = 0;                 end;             end;         end;     end; Output: Conclusion By following these steps, you can create HTML-formatted email notifications in Microsoft Dynamics 365 Business Central. This method ensures that users receive detailed and well-structured notifications, which enhances communication and workflow efficiency within your organization. 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

How to cancel Transfer Order Shipment in D365 Finance and Operations?

In D365 Finance and Operations, managing transfer orders is a crucial aspect of maintaining efficient inventory operations. However, there may be instances where you need to cancel a transfer order shipment due to various reasons such as changes in demand, inventory discrepancies, or operational adjustments. In such cases, it is essential to understand the process of cancelling the transfer order shipment to ensure accurate inventory management and smooth operations. Here are the steps to cancel the transfer order shipment in D365 Finance and Operations: Go to Inventory Management>Out Bound Orders>Transfer Order. Here, I have already created the Transfer Order which is in Created State. Here, I am transferring the Items from (Warehouse W1 to Warehouse W2). The next step is to ship the Transfer Order. In the below screenshot you can see that the Transfer Order has been Shipped. As the Transfer Order is shipped the following Transactions are posted. Now to Cancel the Transfer Order Shipment. In the Transfer Order tab click on Transfer Order History which is under the View Action tab. Here you can see the Transfer Order Shipment. Select that and then click on the Cancel Button from the top of the screen. By clicking this the system will automatically reverse the Transaction. You will see that a Reverse entry is posted with negative quantity and there will be a right tick under the Cancelled Shipment column. Now if I go to Transactions, I can see that the entry has been reversed and the Transfer Order status has been reverted back to Created. Note: The Transfer Order which has been received cannot be Reversed by this process. Transfer Orders which are only in Shipped state or transfer orders where in Shipment has been sent can only be cancelled or Reversed. Depending on your system configuration you may need to manually adjust the Inventory. That’s it for this blog! Hope that helps, thank you for reading!!

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!

Dual Write (DW) – Challenges & Recommendations 

Posted On January 10, 2024 by Richie Jacob Posted in Tagged in

Introduction –   A few years ago, Dual Write (DW) was introduced with the objective of providing a reliable integration between Dynamics CRM and Dynamics Finance & SCM. The intent is in the right direction, but the execution of this vision has not been reliable.   In this blog we have talked about some of the challenges we have faced and our recommendations for reliable integration.   Let’s look at some of the challenges we have faced –  Initial Sync Limitations –  Unavailability of solution in few regions –  Enabling Solution issue and missing File –  Billing Rule Error –  Table Version mismatch –  Other Issues –  Recommendations for reliable integrations –  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 

Opportunity to Sales cycle – Part 2

Introduction: A Step-by-Step Guide to Creating Opportunities and Processing Sales in Business Central Pre-requisites for creating Sales Opportunities: Create Sales Opportunities You can create opportunities from the Opportunity List page. Typically opportunities are created from a specific contact or salespeople. Globally search “Salesperson” and select related link. Select the salesperson from the list for whom you want to create an opportunity. On the salespeople card page, select opportunities action –> selected salesperson opportunities page will open up –> user can create new by clicking on New action. If opportunity is created through salespeople then salesperson code is automatically generated. Globally search “Contact” and select related link. Contacts list page will open up, user can select the contact for which opportunity has to be created. Click on Home –>Create Opportunity for new opportunity. Click on Contact–> Open Opportunity (To view existing opportunity of selected contact) If opportunity is created through contact then contact name is automatically generated. No. – This field is auto generated based on the set no. series. Description – Description of the opportunity. Contact no. – User can select existing contact or create new. Contact name: Contact name is auto generated based on contact no. Phone/mobile/email: Auto generated from contact card page. Contact company name: This field is auto generated from contact card page Salesperson code: if opportunity is created through salesperson then this field is auto populated, if not then user can manually select the salesperson. Campaign no. User can select specific campaign to link with the opportunity. Priority: The default priority is set as normal. Other priorities are Low and High. Sales Cycle code: This is a setup. (To know more refer part 1 of this blog) Status: The status field is updating automatically. Closed: Specifies if the opportunity is closed. Creation date: Opportunity creation date  Date Closed: Specify the date the opportunity was closed. Segment no.: User can link segment to the opportunity. (If any) Sales cycle stages To start the sales cycle, user can click on “Activate first stage” To move an opportunity through sales cycle stages: Sales cycle stage is automatically updated Fill in the rest of the details as necessary. To Close opportunity When the negotiations are finished, you can close the opportunity. When closing an opportunity, you can specify whether it was won or lost, as well as why it was closed. To specify a reason, you must set up closed opportunity codes. To Create Sales Quote To Create Sales Order To Delete Opportunities After you have deleted an opportunity, it is removed it from the Opportunity List page. Conclusion Microsoft Dynamics 365 Business Central provides a robust framework for creating opportunities and processing sales seamlessly. By following this step-by-step guide, you can harness the full potential of Business Central to optimize your sales processes, enhance customer relationships, and drive business growth. Hope this helps!

Switching of Forms using Option Set field in Javascript

Use Case – To Switch form based on the value selected from option set field. Steps – 1. We have a Option Set field – “Lead Type“ Based on the Option selected – the form will switch For example – “PMO Member” – On change of the option, it will switch to PMO Member Form “HR” – On change of the option, it will switch to HR Form 2. To get the current form Guid use the following in the console- 3. Below JavaScript Code- Hope this helps!!

Quick Tip – Duplicate Fields from a Table to another Table

Hello,Consider a scenario where we need to have a table (entity) which is a replica of other table or you need some fields replicated into another table. This tool will save a lot of precious time. Let’s say I have a table called ‘Scoping’ and I want fields from that data replicated into another table called ‘ScopingClone’. Steps you’ll take to do this in a time-efficient manner. Step 1: Create a new Table/Entity. (In my case, I created ScopingClone) Step 2: Navigate to XrmToolBox and install ‘Clone Field Definitions‘, connect to your environment and open the tool. As you can see, the fields that I selected are successfully cloned. I hope you found this blog useful.

Fields in Customer and Vendor Posting Groups in D365 Business Central

CUSTOMER POSTING GROUPS Customer Posting Groups determines the account receivables account.  1. In the search option, enter Customer Posting Groups and then choose related link. 2. In the Code Field, type unique identifier. 3. In the description field, type description of Customer posting group. 4. In each relevant account field, enter the G/L account  that will post the transaction accordingly. Receivable Account: This is a summary account where all the entries from customers will end up in balance sheet. Service Charge Account: This is a fee account where any fee you Charge to the customer when invoicing will end up here. Payment Discount Dr. Account: This account represents cash discounts given to the customers, then the sum representing the difference in original amount and what they’ve actually paid. This will be in debit field. Payment Discount Cr. Account: This account represents cash discounts given to the customers, then the sum representing the difference in original amount and what they’ve actually paid. This will be in credit field. Interest Account: It is an account to which, if you issue reminders or finance charge memos with interest on them, this interest revenue will be posted to this account. Additional Fee Account: This is where the reminder fees and finance charge momos will be posted when they are issued. Add. Fee per line Account: This is where reminder account will be posted if you have a reminder amount on each line of your remainders. Invoice rounding Account: This is where invoice rounding will be posted. Debit Curr. Appln. Rndg. Acc/ Credit Curr. Appln. Rndg. Acc: Both accounts are same except one is Dr and other is Cr. This account is particularly used when you are applying an entry on your customers from different currencies. E.g. Invoice is in USD but payment is in EUROS, in this case rounding difference will be posted to this account. Debit Rounding Account/ Credit Rounding Account: This is same as above mention field except the difference is of same currency and needed a slight adjustment. These accounts will therefore be used to Debit or Credit respectively.  Payment tolerance Debit account/ Payment tolerance Credit account:  These accounts are used to have a payment tolerance towards customers. e.g. If the customers is Invoiced USD 105 but customer pays only USD 100, and you have set a tolerance for 5USD which means the difference will be posted to these two accounts.  Assign Customer Posting Groups to Customers 1. In the search option, enter Customers and then choose related link. 2. Open a Customer Card. 3. Expand Invoicing Tab, in Customer posting group field enter relevant details. VENDOR POSTING GROUPS Vendor Posting Groups determines the account payable account. 1. In the search option, enter Vendor Posting Groups and then choose related link. 2. In the Code Field, type unique identifier. 3. In the description field, type description of Vendor posting group. 4. In each relevant account field, enter the G/L account  that will post the transaction accordingly, Payables Account: This is a summary account where all the transaction from vendors will end up in balance sheet. Service Charge Account: This is a account where you can put any service charge that might come from the vendor. Payment Discount Dr. Account: If you pay your vendor ahead to time and get a cash discount, a debit entry will end up in this account. Payment Discount Cr. Account: This account represents cash discounts given to the customers, then the sum representing the difference in original amount and what they’ve actually paid. This will be in credit field. Invoice Rounding Account: This account is used when an invoice from the vendor has to be rounded. Debit Curr. Appln. Rndg. Acc/ Credit Curr. Appln. Rndg. Acc: This account is used when the different Currencies have to be applied to each other and rounding has to be carried out. Debit Rounding Account/ Credit Rounding Account: This is used when you settle the outstanding amount in same currency but a little rounding off is to be done. Payment tolerance Debit account/ Payment tolerance Credit account: These accounts are used to have a payment tolerance towards vendors. Assign Vendor Posting Groups to Vendors 1. In the search option, enter Vendors and then choose related link. 2. Open a Vendor Card. 3. Expand Invoicing Tab, in Vendor posting group field enter relevant details.

Run/Enable Customer Engagement SSRS Reports on Mobile App Android / iPad

Customer Engagement apps running on a web browser on an iOS or Android tablet provide a similar experience to using it with a web browser on your desktop or laptop computer. However, some features are not available on the mobile app or mobile web browser out of which one is running SSRS reports. Let’s say we need to run a Sales History report as below on a web application. But on mobile but there is not Reports Menu/Button on mobile application. We can use the following work around with Model Driven apps. Step :1 Run the Report 1st time on the web browser and copy the URL.Step Step : 2 Open App designer Step: 3 Create a URL Menu Submenu Item and paste the about URL in the URL field. Step: 4 Save and Publish the app and you can see the same menu appearing on the mobile app # Run the report and it will open on the mobile browse you may continue with the same login credentials. [/vc_column_text][/vc_column][/vc_row]   Hope this helps!

Quick Tip – Enable/Show Activities on Notes in D365 CRM

In this blog, we will see how we can show activities on Notes in D365 CRM.  Step 1 – Click on Entity and check marked Activities. Save and publish the Entity. Step 2 – Open Main form where you have added timeline, Double click on timeline notes and mark filter by as Show all. Save and Publish the form. Output before enabling the activities Output after enabling the activities

SEARCH :

FOLLOW CLOUDFRONTS BLOG :

[gravityform id="36" ajax="true"]

FOLLOW CLOUDFRONTS BLOG :