How to dynamically show and hide the fields in the Request page of Business Central?
Introduction: Based on certain values dynamically show and hide the fields in the request page of the report. Ideally, we cannot directly use visible property to fields. we can do this by enabling the visibility of fields using groups. Steps to achieve the goal: Create a groups and add the fields which you want to show and hide based on selected data. For example, I have an option filed called Filter By- State, Customer, and Both. If I choose Customer then the Customer field should be visible and if I choose State then the State field should be displayed if I choose both then the Customer and State field should be visible. Create a 2 boolean variable which is of InDataset Create Customer and State field and assign it to groups in report. Then the field value which is been used to show or hide other fields write the below code OnValidate trigger So the above code will do the following if my Filter By field is State then the State field will be visible and if it is Customer then only the Customer field will be visible. If both are selected then both Customer and State fields will be visible. Note: If you want to show or hide the field based on only one value then you don’t need to use the InDataset attribute on the Boolean variable Conclusion: Thus we saw how we can dynamically show and hide the fields based on selected values on the request page in Business Central. Thank you very much for reading my work. Hope you enjoyed the article!
Share Story :
How to use Contact email and Sent email functionality on Vendor, Customer, and its Contacts?
Introduction: Contact email functionality is used in order to send emails to customers, vendors, and their contacts. Steps to achieve the goal: Go to Customers / Vendor and its Contact page there is action called as Contact By Email Then click on Contact by Email action. You will be able to get the email based on email address specified in Customer/ Vendor page in Email field. You can see the history of mails send to Customer, Vendor and its contacts. There is action called as Sent Emails action present on list page and also in Card page You will be able to see all the mails which is been send to Customer/Vendor/Contacts You can resend the same mail which is been sent to Customer using Resend action present in Send Emails page. You can also edit the existing mail which you have send earlier and send it with updated one Conclusion: Thus we saw how we can use the Contact email and Sent email functionality in Business Central. Thank you very much for reading my work. Hope you enjoyed the article!
Share Story :
Read items from Array in Power Automate
Let us consider we have array [1,2,3] and want to read each value in Power automate. Let see how we can read array in Power Automate Step 1- Create array (here you can use your array) Here I have array [1,2,3] and now I want read each value of array in loop Step 2 – Add apply to each step In a apply to each step, Add output of array. In this case we have compose. Step 3 – Add action compose and use expression item() to read array from compose Now Save and try to run the flow. In this way you can read value from array in Power Automate
Share Story :
Reopen Closed Appointment Using JavaScript in D365 CRM
Introduction: When an appointment is closed in D365 CRM, the appointment is not editable. There can be a requirment when Users wish to edit the closed appointment and add some missing data. This can be achieved by adding a new button on the Appointment form. Solution: Add a new button and use below JavaScript. var AppointmentForm = { setActive:function(primaryControl) { var formContext= primaryControl; var status= formContext.getAttribute(“statecode”).getValue(); if (status==1) { formContext.getAttribute(“statecode”).setValue(0); formContext.getAttribute(“statuscode”).setValue(1); formContext.data.save(); } } } To understand the status and status reason details, you can refer the Microsoft document- https://docs.microsoft.com/en-us/dynamics365/customer-engagement/web-api/appointment?view=dynamics-ce-odata-9 Note that, you need to update both statecode and statuscode, trying to update only one will give a system error. Conclusion: You can Activate and edit the appointment, once done user can click on Mark Complete, to close the appointment.
Share Story :
C# Code to retrieve lookup value id from target entity in D365 CE.
Let us consider below example as use case We have Plugin that triggers on Update of Contact Table and wanted to retrieve Customer related to Contacts. Customer is Lookup field on Contact Table. Hence here our target entity is Contact. Code – Entity targetEntity = (Entity)context.InputParameters[“Target”]; Guid ContactId = targetEntity.Id; Using the above code we get the target entity Contact Guid and now we need to retrieve Customer lookup from the target Entity. var cols = new ColumnSet(new String[] { “parentcustomerid” }); Since we only want Customer lookup from Contact hence retrieving only Customer and you can retrieve columns as per your requirement. Entity parententity = service.Retrieve(“contact”, targetEntity.Id, cols); We have stored Retrieved values in parententity. Guid ParentAccount = ((EntityReference)parententity.Attributes[“parentcustomerid”]).Id; And in above step we get the Guid of Customer. Conclusion – This was simple example of accounts and Contacts, you can use the above code(specify the schema name of lookup field you want to retrieve) to retrieve any lookups from your target entity based on your requirement Hope this helps !
Share Story :
How to unapply/reverse payments from vendors in Business Central?
There are certain scenarios where you have mistakenly applied the payment to the wrong vendor or you need to refund the vendor. There are two methods in order to resolve these issues. Steps to achieve the goal: Method 1: Globally search vendors. Select the vendor in which payment is applied incorrect. Go to Vendor Tab-> Ledger Entries tab. Open the Ledger entries of that vendor and then select the payment which you want to unapply. Go to Process tab and Unapply Entries. A Unapply Vendor Entries page gets open select the payment line and then click on Unapply action and click on OK. Once you click Ok the payment line in vendor ledger entries its remaining amount will not be 0. In order to balance the G/L entries we need to post the refund entry. Go to payment journal-> select the document type Refund Posting date must be same as Payment Posting Date or actual refund date. Assign the Account type as Vendor and assign the Vendor number. Select the Applies to Doc Type as Payment and in Applies to Doc No assign the Payment Document Number. Select the payment method code of return. Select the balance account number appropriately. Post the entry. If you go and check the vendor ledger entries it will be nullified against the refund. OR Method 2: Repeat above step number 1,2,3,4,5 and 6 from Method 1 Go to Process tab-> Reverse transaction. Reverse Transaction entries page is open and in which there is action called as Reverse Transaction click on it and entries will be reversed. Conclusion: Thus we saw how we can reverse/unapply the payment mistakenly applied to the wrong vendor in Business Central. Thank you very much for reading my work. Hope you enjoyed the article!
Share Story :
How Caching Works in Business Central
References: Data Access – Business Central | Microsoft Docs Database.SelectLatestVersion Method – Business Central | Microsoft Docs Explanation: Caching is one of the methods which systems use to improve performance and respond to requests rapidly. In a Business Central system, caching is done at two levels: Business Central Server Instance Data Cache SQL Server Data Cache. Whenever a User requests data from Business Central, it firsts check whether The data is available in the Server Instance’s cache, If not, then it checks the SQL Server Data Cache, And if not here then it fetches the data from the database. The Business Central Server Instance’s Cache is accessible to all the Users connected to that Server Instance. There are two types of cache stored here, Global Cache Private Cache Global cache is the one which is accessible to all the Users connected to the SQL Server. Private cache is only accessible over a transaction, for a particular User, for a particular company. This cache is cleared as soon as the transaction is completed. Which cache is to be used for which User depends on whether the Table from which the User is requesting data is locked or not. In case it is locked, Private Cache is queried else Global Cache is queried. The following procedures in Business Central support using Cache: GET GETBYSYSTEMID FIND FINDFIRST FINDLAST FINDSET COUNT ISEMPTY CALCFIELDS Whenever we make a call to the “FIND” functions, 1024 records are cached. The Data Cache size in Business Central can be changed using the “Data Cache Size” setting of the Business Central Server Configuration file. The default value is set to 9 which is equivalent to 500mb. Increasing the value by 1 doubles the cache size. If we want to latest data from the database to be fetched, i.e. if we want to bypass the cache, we can use the “SelectLatestVersion” procedure. The results from Query objects in Business Central are not cached. If there are multiple Server Instances over a single database, Business Central synchronizes the cache every 30 seconds by default. We can change this by using the “CacheSynchronizationPeriod” parameter in the CustomSettings.config file. Conclusion: Thus we saw how to Caching works in Business Central and how we can optimize it usage for maximum performance in Business Central.
Share Story :
Create attachments in SharePoint when email arrives
Use case – we wanted to retrieve attachment when new email arrives in outlook and create same file in SharePoint Let see how we can achieve this! Step 1 – Flow triggers on when a new email arrives trigger from Outlook connection. Step 2 – Retrieve attachments and Create file in SharePoint. Add step create file from SharePoint connection. In Create file, Add site address, Folder path, File name, File Content. Here file Content is the Attachment content from Trigger and File Name should be Attachment name. Save the flow and try. Hope this helps!
Share Story :
How to work with Drop Shipments in Business Central?
Introduction: Drop shipment is used when the shipping on the items is done from the vendor directly to the customer without the item coming back home to your warehouse and you delivering them. Steps to achieve the goal: To do so first create sales order and then add field drop shipment which is of boolean type using personalize features in business central Add item in sales order line and mark drop shipment if you want that item to be transported directly from vendor to customer Then create purchase order assign vendor to it and then don’t add any purchase lines instead of that go to shipment and payment tab in Ship-to field select customer and then add that customer which you want And go to action tab in purchase order page -> Drop shipment -> Sales Order ->Sales order list window Select the item that you want to get shipped directly and that item will be added in purchase orders line In order to check the link is established between sales and purchase order. Go to Sales order then in sales order line -> Order -> Drop Shipment -> Purchase orders It will open the corresponding purchase orders which you created And post the Sales order. Conclusion: Thus we saw how we can use Drop shipments in Business Central. Thank you very much for reading my work. Hope you enjoyed the article!
Share Story :
How to list all dates between two dates in PowerBI and distribute numbers evenly among them.
Consider a scenario where a start and end date along with the total duration for a particular task has been given to us. We have to distribute the total duration equally among all dates between the start and end date. We can solve this issue by the combination of Power Query and DAX. Lets see the steps First we need to generate the list of dates from start date till end date. Open Advance Editor As you can see the table I’m working on have two columns for start and end date for a particular task respectively. In Power Query we cannot generate a list between dates so first we have to convert the data type from date to numeric. This can be easily done by right clicking the desired column and changing the data type right away. After the data type of respective columns is changed into numeric, click on the “Add Column” option in the ribbon and select custom column. To generate a list in Power Query the syntax is “starting number .. Ending number” so we apply this syntax in accordance to our needs. The “Number” function is make to sure to take only numeric values to avoid any conflicts. After validating the code press the “OK” button. You can see a new column with lists. Click on the Expand button on the top right of the column. After Expanding the column you’ll see a list of numbers. Since these numbers are numeric we have to again convert them in Date format. This can be done by right clicking on the column and changing its Data Type. As you can see we can see all the dates between start and end dates now. 2. Since we generated the list of dates. We Proceed to distribute duration equally Create a new Calculated Column in PowerBI Desktop Write the following DAX. actual hours = Sheet1[original estimate]/ CALCULATE(count(Sheet1[taskid]),FILTER(Sheet1,Sheet1[taskid]=EARLIER(Sheet1[taskid]))) This code divides the Duration assigned for a task by the count of the total tasks where the task id is same. As you can see the Original Estimate column which is for total duration for a task is equally divided into a new column called “actual hours”. You cant see dates of Saturday, Sunday as I filtered these dates in Advanced Editor itself as they are non working days. This can be modified according to requirement. Thank you for reading hope this article helped
