D365 Business Central Archives - Page 9 of 33 - - Page 9

Category Archives: D365 Business Central

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!

Share Story :

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!

Share Story :

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!

Share Story :

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!

Share Story :

Optimizing Project Impact: Continuous Monitoring of Client System Utilization for Enhanced Value Deliver using Business Central

Introduction: It is crucial for the management team to track the client’s utilization of the system as a key metric for assessing the project’s success and the value it brings to the client. To facilitate this monitoring process, I have developed a utility that can automatically generate and send reports to the management team, detailing the number of records created in specified tables. For example, during the initial master data upload phase, 1500 data added into the Customer table. Subsequently, over the following month, this figure increased to 1750 and then to 1950. Such trends signify that the client is utilizing the system in line with expectations. Pre-requisites: Configuration: Usage Statistics Setup Page: This page, contains two main fields:- Collect Statistics (Boolean) and Mail Recipients (which contains email id’s to which the report has to be send) and one more field that is primary key field is added in table but not in page and it is set to code due to which the header we get as required in Usage Statistics Setup Page. The datatype of the field primary key is set to header because the default number of code is null. Regex is used for pattern matching. Here, email validation is added on Mail Recipients. User can enter multiple email addresses in this format eg. abc@gmail.com;xyz@gmail.com. If the Collect Statistics is enabled than only you can process further and there should be at-least one mail id present in Mail Recipients. Usage Statistics Configuration Page: This page contains the actual data from which the data will be passed and report will be generated. The list and the card pages are also created with same fields. The “All Object With Caption” is used for viewing all object details in the system. The trigger lookup is used to get the table no. and table name at runtime. After fetching the specific table no. and table name, fields will filter according to the filter field 1 value, same goes for filter field 2 value. (filter field 2 is added according to the requirements.) The FieldsDisplay procedure is used to retrieve field no. and field name of the according to its record. In Filter Field 1 Name any field can be selected and filter field 1 value must be set according to that field. Create Statistics Report: This report is designed to automate the generation of usage statistics based on configurations specified in the “Usage Statistics Configuration” table. The report is flagged as “ProcessingOnly,” indicating it is intended for background processing rather than direct user interaction. The dataset within the report contains a data item with an “OnAfterGetRecord” trigger, which executes after each record is retrieved. This trigger is responsible for processing each configuration record, applying filters, and updating or inserting records into the “UsageStatistics” table. Additionally, the report features an “OnInitReport” trigger that checks the “Usage Statistics Setup” table to ensure that statistics collection is enabled. If this condition is not met, an error message is displayed, and the report exits. In essence, this report streamlines the creation of usage statistics in Business Central, adhering to specified configurations and ensuring the necessary setup conditions are satisfied before processing. Usage Statistics Page: After filter the number of records the data which will be generated will be displayed in this table. List will also be created with same fields. In Record Count the number of values are there which satisfies the filter condition. Send Statistics Report: This report is designed to send usage statistics via email. Let’s break down the code: The report begins with specifications such as its application area, caption, and usage category. Notably, it is marked as a “ProcessingOnly” report, indicating it is intended for background processing rather than direct user interaction. The OnInitReport trigger executes when the report is initialized. It checks settings in the “Usage Statistics Setup” table, ensuring that statistics collection is enabled (“Collect Statistics”) and valid mail recipients are specified (“Mail Recipients”). If these conditions are not met, error messages are displayed, and the report exits. The main functionality is in the OnPostReport trigger, which executes after the report is processed. It performs the following steps: Email Excel Sheet: In this, on 22nd date after applying the filters the output is given and on 24th it again checks by applying same filter since new data was not added in the respective table that’s why it is showing the same data. Conclusion In conclusion, the automated reporting tool plays a pivotal role in monitoring client system utilization, revealing encouraging trends such as the gradual increase in customer records. These insights affirm the project’s success and underline its value to the client, reinforcing our commitment to proactive monitoring for continual optimization and client satisfaction.

Share Story :

Get and Post Method in Business Central

Introduction: HTTP (Hypertext Transfer Protocol) is a protocol used for communication between web servers and clients. When a client sends a request to a server, it is called an HTTP request. The request consists of a request line, headers, and an optional message body. The request line contains the HTTP method, URL, and HTTP version. The headers contain additional information about the request, such as the user agent and content type.  When the server receives the request, it sends back an HTTP response. The response consists of a status line, headers, and an optional message body. The status line contains the HTTP version, status code, and reason phrase. The headers contain additional information about the response, such as the content type and server type. Pre-requisites: Configuration: So, in this we are going to use table extension of the table Item [Record id: 27]. It extends the “Item List” page by adding a button after the “History” action. The button is defined as an action with the following properties: ApplicationArea, Visible, Image, and trigger OnAction(). When the button is triggered, it sends an HTTP request using the HTTPRequestFact() and HTTPRequestFactPost() functions. The HttpClient.Get method to send an HTTP GET request to retrieve data from a remote server. The syntax for the HttpClient.Get method is as follows: [Ok := ] HttpClient.Get (Path: Text, var Response: HttpResponseMessage) Here, Path is the path of the resource you want to retrieve, and Response is the response received from the remote endpoint. The HttpClient.Get method returns a Boolean value indicating whether the operation was successful or not. If the operation was successful, the Response parameter will contain the response received from the remote endpoint. This code sends an HTTP GET request to the URL https://ene6g2z8lzf2g.x.pipedream.net/ using the HttpClient.Get method. The response received from the remote endpoint is stored in the Httpresponsemessage variable. If the operation was successful, the response is read as a string and stored in the Response variable. Finally, the Message function is called to display the response on the screen. The HttpClient.Post method to send an HTTP POST request to a remote server. The syntax for the HttpClient.Post method is as follows: [Ok := ] HttpClient.Post (Path: Text, Content: HttpContent, var Response: HttpResponseMessage) Here, Path is the path of the resource you want to post data to, Content is the HTTP request content sent to the server, and Response is the response received from the remote endpoint. The HttpClient.Post method returns a Boolean value indicating whether the operation was successful or not. If the operation was successful, the Response parameter will contain the response received from the remote endpoint. This code sends an HTTP POST request to the URL https://enni1en7jg0n.x.pipedream.net/ with the JSON payload constructed from the records in the current page. The HttpClient.Post method is used to send the HTTP POST request. The response received from the remote endpoint is stored in the Httpresponsemessage variable. If the operation was successful, the response is read as a string and stored in the Response variable. Finally, the Message function is called to display the response on the screen. The code first sets the filter for the current page to the “Item” record. It then loops through all the records in the “Item” record and creates a new JSON object for each record. The JSON objects are added to a JSON array. A new JSON object is created for the JSON array, and the JSON array is added to the JSON object. The JSON object is then written to a text variable. A new HTTP content object is created for the JSON payload, and the JSON payload is written to the HTTP content object. The HTTP POST request is then sent to the remote endpoint using the HttpClient.Post method. If the operation was successful, the response is read as a string and stored in the Response variable. Finally, the Message function is called to display the response on the screen. The RequestWithBasicAuthenticaton procedure takes in three parameters: Url, Username, and Password. It creates an HTTP request message with the given URL and sets the method to GET. It then adds the authorization method by encoding the username and password in Base 64 and adding it to the request headers. After that in if condition it sends an HTTP GET request to the URL specified in the Url parameter with basic authentication using the HttpClient.Send method. The HttpClient.Send method is used to send the HTTP GET request. The response received from the remote endpoint is stored in the ResponseMessage variable. If the operation was successful, the response is read as a string and stored in the Response variable. Finally, the Message function is called to display the response on the screen. Output: For Multiple Data, Conclusion: In conclusion, this blog has provided valuable insights into the fundamental concepts of HTTP GET and POST methods, along with an exploration of Basic Authentication in the discussed code. Readers now have a clearer understanding of how these key HTTP techniques, combined with authorization mechanisms, play pivotal roles in web communication, facilitating data retrieval, creation, and ensuring secure access. Introduction: HTTP (Hypertext Transfer Protocol) is a protocol used for communication between web servers and clients. When a client sends a request to a server, it is called an HTTP request. The request consists of a request line, headers, and an optional message body. The request line contains the HTTP method, URL, and HTTP version. The headers contain additional information about the request, such as the user agent and content type.  When the server receives the request, it sends back an HTTP response. The response consists of a status line, headers, and an optional message body. The status line contains the HTTP version, status code, and reason phrase. The headers contain additional information about the response, such as the content type and server type. Pre-requisites: Configuration: So, in this we are going to use table extension of the table Item [Record id: 27]. It extends the “Item List” page by adding a button after the “History” action. The button is defined as an action with the following properties: ApplicationArea, Visible, Image, and trigger OnAction(). When the button is triggered, it sends an HTTP request using the HTTPRequestFact() and HTTPRequestFactPost() functions. The HttpClient.Get method to send an HTTP GET request to retrieve data from a remote server. The syntax for the HttpClient.Get method is as follows: [Ok := ] … Continue reading Get and Post Method in Business Central

Share Story :

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!

Share Story :

Opportunity to Sales Cycle – Part 1

Introduction: In this blog I will demonstrate the set ups for opportunities. The sequence for setting up opportunity to sales cycle is as follows: Opportunities: Any inbound lead could be viewed as a potential sales opportunity. You can make opportunities and link them to certain salespeople to keep track of possible sales. You must first build up sales cycles and sales cycle stages before you start working with opportunity management. When creating opportunities, you should include details such as the contact, salesperson, sales cycle, and dates as well as your estimates of the opportunity’s sales value and success odds. Set up Opportunity Sales cycle Codes: Set up Opportunity Sales cycle Stages: On the Sales Cycles page, select the line for which you want to set up stages, and then choose the Stages action. The Sales Cycle Stages page opens. Stage: Specify the stage number. Description: A description for particular stage Completed %: Specifies the percentage of the sales cycle that has been completed when the opportunity reaches this stage. Chances of Success %: Specifies the percentage of success that has been achieved when the opportunity reaches this stage. Activity Code: User can select the activity Code for particular stages. (Activities have to be created separately) Quote Request: this check box puts a validation on that particular stage to request quote. Allow Skip:  this check allows user to skip that stage. Date Formula: Specifies how dates for planned activities are calculated when you run the Opportunity – Details report. Comment: Specifies if comments exist for the selected stage. (To add comment on any stage, navigate to Related –> Sales cycle –> Comments) Set up activities with task: You can combine multiple task, in an activity. A task represents a step in the activity. You can assign activities to opportunities, salespeople, or contacts. Assign tasks or activities of tasks to opportunities. The following procedure describes how to assign activity tasks to opportunities. The steps are similar when you assign tasks to salespeople and contacts. I will be demonstrating how to create Opportunity and Process sales Opportunities in part 2. Hope this helps!

Share Story :

Posting Restriction in Business Central for different users for Purchase and Sales documents

Introduction Invoices and shipments are frequently handled differently by different businesses. Processes, for example, can range from one person posting everything on a purchase order to numerous employees working on their own sites. On the User Setup page, you can now select how each user can handle invoices. Steps to achieve the goal 1. Go to User Setup select the users you want to give this restriction and then there are two columns Sales Invoice publishing Policy and Purch. Invoice Posting Policy 2. There are three values in these options Below is the impact of the above three options in different documents of purchase and Sales transactions. Document Option 1: Allow Option 2: Prohibited Option 3: Mandatory   Displays a series of options Confirmation dialog Confirmation dialog Sales Order Ship Do you want to post the shipment? Do you want to post the shipment and invoice?   Invoice       Ship and Invoice     Sales Return Order Receive Do you want to post the receipt? Do you want to post the receipt and invoice?   Invoice       Receive and Invoice     Inventory Pick Ship Do you want to post the shipment? Do you want to post the shipment and invoice?   Ship and Invoice     Purchase Order Receive Do you want to post the receipt? Do you want to post the receipt and invoice?   Invoice       Receive and Invoice     Purchase Return Order Ship Do you want to post the shipment? Do you want to post the shipment and invoice?   Invoice       Ship and Invoice     Inventory Put-away Receive Do you want to post the receipt? Do you want to post the receipt and invoice?   Receive and Invoice     Warehouse Shipment Ship Do you want to post the shipment? Do you want to post the shipment and invoice?   Ship and Invoice     Note: If you are trying to post invoice transactions from the general journal the above restriction would not be used in the General journal table. Conclusion Thus we saw how we can restrict the users to post the purchase and sales transactions. Thank you very much for reading my work. I hope this helps!

Share Story :

How to display Media (Picture) Data from one table to another table and display it on the RDLC report

References FlowFields – Business Central | Microsoft Learn Creating an RDL Layout Report – Business Central | Microsoft Learn Pre-requisites Microsoft Dynamics 365 Business Central Cloud/On-Premises Introduction In this blog, I am going to showcase how to flow Media (Picture) from one table to another and how to display it on the RDLC report. Flow Media data from one table to another table For this example, I’ve made a simple Mediadatatype table with a few fields and kept the ‘Image’ field as a Media data type. Additionally, I created the ‘Image’ field as a Media datatype to the Purchase header table extension and used the Fieldclass property as a flowfield and the Calcformula for the flow Image on the ‘Image’ field. The Image flows on the Purchase order ‘Image’ field, where my assigned user Id is PD, thus the image will appear on the Image field. How to display Media data type (Image) on RDLC report. In the following example, I’ve added an Image column to the MediaDatatype report Open the report on RDLC layout. On an Image property, select the image source as a database, use an ‘Image/bmp MIME type, and set the Image expression.      Output Conclusion Thus, we saw how to flow Media datatype from one table to another and how to display it on the RDLC report. I hope this helps!

Share Story :

SEARCH BLOGS:

FOLLOW CLOUDFRONTS BLOG :


Secured By miniOrange