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
Share Story :
Using Partial Records in Business Central
Introduction: Business Central allows us to load records partially, i.e. only certain fields from a table which can be defined by the User. As this requires less data to be pulled out from SQL and similarly less data to be sent over the network, using partial records provides a significant performance gain. Even more so if the table has multiple extensions attached to it. The methods for partial loading are also available on Record References. References: Partial Records – Business Central | Microsoft Docs Record.SetLoadFields Method – Business Central | Microsoft Docs Usage: There are two groups of methods which we can use for Partial Loading. First, which set the Fields to be loaded prior to fetching the records and secondly which load the fields after the initial fetching. SetLoadFields – It is used to specify the fields which are to be loaded when the record is to be fetched using the “GET” or “FIND” procedures. Reusing this on the same record variable leads to resetting of the fields to be loaded. AddLoadFields – It is used to load another field, in additional to the fields that have been loaded. Calling this Procedure repeatedly on a record does not lead to resetting of the fields that are to be loaded. AreFieldsLoaded – It is used to check if the fields mentioned are loaded already or not. LoadField – It is used to load more fields in addition to the fields that have been loaded already. To load the fields it uses a technique known as JIT Loading. Conclusion: Thus we saw how we can make use of partial loading of records with minimal code in Business Central! As a side note, I would like to mentioned that it is not recommended to use a partially loaded record for Insert, Update or Delete operations as these operations require a record will all fields loaded.
Share Story :
[Resolved]You don’t have permission to view files in this location, Contact your Microsoft team owner or SharePoint administrator for access.
We added a new User in CRM, User has the System Administrator role but still were getting the below error. You do not have permission to view files in this location, Contact your Microsoft team owner or SharePoint administrator for access. We did check User’s SharePoint access and, but it did not work. Solution – In User entity [OOB], there is OOB field called as “Sharepointemailaddress”. Add same email id of User -> save the record and it will be resolved. Hope this helps!
Share Story :
How to integrate entities from one CRM system to another using Tibco cloud integration
Sometimes we may feel the need to copy our data from one Microsoft Dynamics 365 CRM environment into another for scenarios such as moving data from UAT environment to production, copying data from Parent organization to Child, etc. This can be easily achieved by leveraging Tibco Cloud Integration’s simple and no code approach. Following is the method in which we can integrate our data Go to app.scribesoft.com and from the dashboard create a new integration app. Inside the app dashboard click on the Hamburger style button and then click on Create integration Map option In the page that opens up we can name our map as desired. Since I am going to integrate account entity in this tutorial I have named it as account integration. Now we have to add a source connection from which data will be extracted, here we can use existing connectors or create a new connector. After clicking the Ok button the metadata for source connector will load, in the meanwhile we can add Destination connector as well. We have to wait a while until the metadata of both source as well as destination gets loaded. After the connectors get loaded we have to drag the Query block from the source connector to the map designer as we want to Query and get the required entities first. Double click on the Query block and from the entity drop down you can select any entity you want to copy from source to destination, for this tutorial I am selecting Account entity. From the filter tab you can choose to filter records from the entity based on the fields. After adding filters, in order to check if correct data is being pulled from source along with the filters applied click on the Preview Tab and verify the values of the fields of the entity. Validate and click on Ok button. Now since there may be multiple records, for each record in source we have to create a record in the destination for doing this we use For Each loop from the Controls section. Since for each record we found in source we have to create a record in destination we will insert the Create block from destination connector in between the For loop. Now we will double click and open the Create block and select Account in the Destination Connector’s Entity. In the fields tab we will map all the necessary fields required to create an Account in CRM and then click on the OK button. If some important field isn’t mapped correctly it will throw an error during validation. Our map is now ready without any errors we will click on the Apply button and save the map and proceed for debugging. Debugging is important as it helps us to understand the flow of Data and if in case of any errors they can be tracked easily, In the Debug mode click on Start. Click on Next to see step by step execution of the map, and continue to finish running the map. After execution is complete the following window will be shown If you check the destination CRM now you will find the new record has been reflected from source. This was it, in few steps we copied Data from one CRM system to another. Thank you for reading my blog, hope it helped !!
Share Story :
Enable multiple pickup delivery modes for customer orders in D365 Retail POS(Commerce )
In Microsoft Dynamics 365 Commerce version 10.0.16 and later, Retailers can define multiple modes of delivery that shoppers or sales associates can choose among when they create an order that will be picked up at a store. In this way, organizations can provide multiple pickup options to their shoppers. For example, many retailers now offer shoppers the choice of in-store pickup or curbside pickup for their orders. Commerce supports the configuration of these different pickup delivery modes. Users can then take advantage of them when they create customer orders in any supported Commerce channel (e-commerce, call center, or store). To use this functionality, turn on the Support for multiple pickup delivery modes feature in the Feature management workspace in Commerce headquarters. After you turn on the feature, additional configuration is required. After you turn on the Support for multiple pickup delivery modes feature, you can define multiple pickup delivery modes in the Pickup mode of delivery grid on the Modes of delivery FastTab on the Customer orders tab of the Commerce parameters page. In store channels, if a customer order for pickup is created through the point of sale (POS) application, the sales associate is prompted to choose among the available pickup delivery modes, if any have been configured. If only one valid pickup delivery mode is available for the channel and item, the sales associate isn’t prompted to select it. Instead, the available pickup delivery mode is automatically applied to the order lines. Hope this helps!