Tag Archives: Dynamics 365
Let’s get started with Azure Function for Dynamics 365 CRM: Part 1
In this blog, we will learn how to create an Azure Function App to connect it with Dynamics 365 CRM and perform the CRUD operation in Dynamics 365 CRM. First, we will create an Azure Function project for Dynamics 365 CRM from Visual Studio, and below are the steps for the same. Open Visual Studio and create a new Azure Function Project. Filter platform as Azure, select Azure Function, and click on Next. Name your project and click on Create button. After clicking on Create, you will get the below screen where you need to select the Trigger and Azure Function v1 (.Net Framework) and click on Create. In my case, the Azure Function trigger will be Http Trigger which means when an azure function will receive an HTTP request it will trigger. Your Azure Project will be created and the following will be the structure of the project. Now, we will create Azure Function to connect with the Dynamics 365 CRM we need to add the required NuGet Package [Microsoft.CrmSdk.CoreAssemblies]. To add the NuGet Package right-click on the Project and click on Manage Nuget packages. Add Microsoft.CrmSdk.CoreAssemblies in your Project. Following is the code to connect the Dynamics 365 CRM. Currently, we are going to use the credential by specifying them in the C# Code or you can use it as constant. Later in the series, we will learn how to use Environment Variable and pass the credential more secure way in Azure Function using Azure Key Vault. [Stay tuned..!!] Now, select the code and Refactor the code and make the connection function that will return the IOrganizationService if the connection is established else return null. Now, the final code will be as below: Now, we will create a customer with a Hardcoded name when the function is triggered with an HTTP request. Update the existing code with the below code: Testing: We will require the API testing tool, here I am using Postman and the following is the link to download “Postman”. https://www.postman.com/downloads/ To test the application, click on the Start button on top of Navbar as mentioned below in the screenshot [Button will have Project Name]. It will take a few minutes to Load the Azure Emulator Following is the screen you will be able to see and copy the URL highlighted in the red below and paste that URL in Postman. Open the Postman and click on the create a new tab; Select request as POST and paste the URL: After pasting the URL, click on Send You will get the following response on the Azure Function Tool and Postman If there any error or issue with the Azure Function code, the request will be failed and will be displayed on both Azure Function Tool and Postman [Status will be “4**” or “5**” ] Now, we will take look at Dynamics 365 CRM environment and check whether the account is created or not. We are justing getting started with Azure Function for Dynamics 365 CRM and stay tuned for more in this series. Upcoming blogs 1. How to use Dynamics 365 Credentials securely using Azures Function. 2. How to create Dynamics 365 integration with Third-party Applications. Many more……
Change Currency format in D365 Customer Engagement
In this blog we will see how we can change the currency format in D365 CE. We are using the Currency field named Price on Account form and we wanted to price in XX,XX,XXX.XX format Let see how we can achieve this. Solution: Go to Settings and click on Personalization settings. After clicking on Personalization setting, In Set Personal Options click on Format. Click on Customize -> in Number, Digit group change the format as per requirement. After updating click on Apply and Ok. In our requirement, we wanted currency in XX,XX,XXX.XX format on Account Entity. Price field Before Changing – Price field after changing –
Track an Entity record form opening / retrieve activity by system user in Dynamics 365 CRM
If you want to track a user who has opened records of any specific entity then you are on the right blog because today we are going to see how we can do simple customization to track the user activity of who has open which record for how many times. Step 1: Create an Entity to track the log of retrieve activity of the registered entity. Following are fields in the entity to track user activity tracking activity 1. Name — Logical name of Retrieved Entity. 2. Record Id — Record Id of that Retrieved Entity. 3. No of Time Retrieved — Stored number of times a user has retrieved that specific record. Step 2: Create a Plugin to create a Retrieved Log record The record will be created or updated whenever the user opens the entity form to check details and the following is code for the same. Explanation: 1. When the plugin will trigger it will check if the retrieved log of that record is already present or not. 2. If retrieve records is not present it will simply create a log record with the following details a. Name — Type of records which user has opened [Entity] b. Record Id — Record Id of record which user has opened c. User — which the user has opened the record. d. Count = 1 3. If the retrieved record is already existing in the system then it will increment the count of the number of times a user has retrieved that record by 1 so that we can track how many times the same user has open that specific record. Step 3: Register the Plugin on Retrieve of Entity on entities for which you want to add tracking. Retrieve: It will trigger whenever an entity form is open by any user. While registering the new step for the plugin please make sure that Run in User’s Context must be “Calling User” so that we can have a track that which user has opened which record. Note: All security roles which are given to the user should have read, create and update right to “Entity Tracker” Entity. Also, the stage of execution of Plugin and execution mode must be “PostValidation” and “Asynchronous” so that it will not affect any system jobs and it can run in the background process. If you want to track a retrieve activity of opportunity then you just need to register the new step and select Primary Entity as an opportunity as I have already done for Account and Contact. Now, your system is ready to track the user’s entity retrieve activities, and you will see the following records: Using the above record you can create any type of custom charts and put them in your admin dashboard or you can create a Power BI report to track activity. I hope this helps you, if yes please like the blog. And, the next blog will be on the dashboard & charts based on our Entity Tracker records so stay tuned for that!
Autosave quick create a form record on fields change and open the created record
Requirement: The user will create the record from the Quick Create and on change of specific field, the record should automatically save. Whenever the record will be saved it should open the created record. In our scenario, we are going to use the Account Entity. When the user will enter the main phone data in the Account Quick Create Form, the record will automatically save and it will open the created account record. Steps: Go to Default Solution or your customization solution and Open the Quick Create Form from Account Entity 2. Click on the Form Properties to edit the form properties of Account Quick Create Form and add the script on the form. 3. Click on the +New button to add the JavasScript web resources on the form so that you can use the script function on Form Events 4. If you wanted to use an existing Web Resource then you add it or else create new by click on new 5. Create a new Script and add it on form 6. Now, we need to add the event list and bind the calling function to it. To do it click on the + New on Event Listener of Form Properties. Note: Please don’t forget to pass the execution context as the first parameter to the function. 7. We will use formContext.data.save() function to get the created record’s GUID and open entity record using that GUID. Following is code for your reference: 8. Code Explanation: a. quickCreateonSave is a function that is trigger on change of Main phone fields of Account Quick Create. b. When the function is triggered we are using formcontext.data.save to save the save so that we can get the GUID of the recently created record. c. On formcontext.data.save() we can assign two functions — on success and failure as parameter to .then() [Reference] d. On Success, the function will return the following response where you can get the entityType, entity id, and name of the record. e. After getting the entity id and entity type, we can use the open form to open the record as mentioned in the Code. 9. Publish all the customization that you have done on the Account Entity Demo: I hope it helps you guys!!
D365FO – HTTP Error 503. The service is unavailable
Introduction: In this blog, we will see how to resolve HTTP Error 503 – The service is unavailable in Microsoft Dynamics 365 Finance and Operations Details: For resolving these kinds of errors, we have 2 solutions as of now. One is to do from the front end that is LCS and the second is to do from the back-end that is from Visual Studio From LCS: Reset the IIS from the LCS. Steps: 1. Go to LCS, login 2. Select the respective project, full details 3. Go to Maintain -> Restart service 4. Select IIS and confirm it 5. Wait till the service is being restarted From Visual Studio: From the back-end, open the VM and follow the below steps: 1. Login to VM 2. Open the Visual Studio 3. Go to Dynamics 365 tab 4. Click on Restart IIS Express That’s it. Build the project and go to the frontend and check the output how it looks like. Thanks for reading and stay connected with us for more updates!!! Jagdish Solanki | Senior Technical Consultant | CloudFronts Business Empowering Solutions Team “Solving Complex Business Challenges with Microsoft Dynamics 365 & Power Platform”
Integrate Customers from Shopify with D365 for Finance and Operation using Microsoft flow
Using Microsoft flow you can automate and organize the flow of data between your Shopify and Microsoft D365 for Finance and Operation This the 1st part of 2. In this, I will show you how customers can be auto-created in D365 for Finance and Operation when it’s created in Shopify. First, log into Shopify as Admin. Navigate to: Settings -> Notifications -> Webhooks (Scroll to the end) -> Create Webhooks and select customer creation, and JSON format. We need a URL for sending customer details, which we will provide later. Now login to power apps or Microsoft automate with D365 account. Navigate to Flows -> New and select Instant from Blank. Now continue as shown in the below screenshots. Here the required URL will be generated after the flow has been saved. Click on the new step and search for Parse JSON. In Content select Body (parameter from previous steps). Now we need JSON schema for customers. You can find a sample Json return response from https://shopify.dev/docs/admin-api/rest/reference/customers/customer?api[version]=2020-04 Copy the response and select Generate from the sample in Powerapps and paste the response. The schema would be now generated. Click on ‘new step’. and search for Dynamics 365 for Fin & Ops. Click on Create record. Select the instance of the environment you want customers in and Entity name ‘CustomerV3’. Now you can place parameters from the previous step (Parse Json) in different fields such as. Mandatory fields that are required to create our customers are Customer account, Currency, Customer group, Company, Organization name. After the values are placed, click on Save at the top right corner. Now expand the first step and a URL will be there. Copy this URL to Shopify webhook and click Save webhook. Now let’s test this. Go to the customer’s section in Shopify and click Add Customer. Write the first name and last name for now and click save. Go to D365 F&O and navigate to All Customers. You should see a new customer created. In the next part, I will show how we can auto-create product in Shopify when created in D365 for Finance and Operation Thank you for reading!
How to enable out of the box hyperlink feature for SSRS Reports in D365 Finance and Supply Chain Management
In D365 Finance and SCM there are lot of out of the box SSRS reports in which you have hyperlink to move to that particular record (for example Ledger transaction list). But sometimes when you update environment you might end up with no such option in you SSRS report as you can see in following screenshot. To enable hyperlink features you need to follow following steps:- Navigate to feature management and go to all section in that Search for Report drill through links and disable this feature Search for Report PDF viewer and disable you need to disable this feature for following limitation which you can find in screenshot. Now check desired SSRS reportNow you are able to see hyperlinks links in the reports I hope this post will be helpful to you, Thank you!
CloudFronts Dynamics 365 Finance & Operations Update Steps & Protocol
Microsoft is committed to delivering predictable service updates. These service updates will be made generally available for self-deployment approximately 2 weeks before Microsoft automatically applying the update. Some of these updates can have a lot of changes in it and this can impact any customization done on the client’s environment. Thus it becomes very important for a partner to do complete testing before any update is applied. CloudFronts is dedicated to ensuring business continuity of the client and thus have protocols set up to ensure nothing gets impacted on the client’s production environment. Following are the protocols for the same : Service Update Availability – Key points: Each service is released by the Microsoft which has following dates criteria: Preview availability date: When the update is in preview by Microsoft. Generally available (self-update) date: This update will be made generally available for self-deployment approximately 2 weeks before Microsoft automatically applying the update. Auto-update schedule (via LCS update settings) production start date: A date for applying the service update in the production environment. End of service date: Date from when service update is over. Referenced image: For checking the release dates for the above criteria, link as: https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/fin-ops/get-started/public-preview-releases How Long it can be delayed for Next Service Update? The customer can pause, delay, or opt-out of an update via Update Settings in the Lifecycle Services projects. A customer can choose to pause up to 3 consecutive updates. The following is an example of a delayed update: The customer is currently on version 10.0.2. The customer can pause updates 10.0.3, 10.0.4, and 10.0.5. The customer must take the 10.0.6 update when it is available. Upcoming Schedule of Update The customer has the option to apply the update when it is convenient, or let Microsoft auto-apply the service updates based on the selected maintenance window. Customer must require to have an update no older than 4 months Critical Issues Critical issues should always be submitted to the support team via Lifecycle Services as soon as they are identified. The support staff will work with you on the resolution to the critical issue. Path for Early Service Update Scheduling Go to LCS -> Project settings Update settings Pausing the service update temporarily. As shown in the below image, when updates resume, the designated sandbox and production environment will be updated to the latest service update before it can be paused again. HOW TO CHECK UPCOMING UPDATES FROM LCS? In update setting -> click on view the update calendar It looks like: This will help us to plan the next scheduling for service updates. According to this, we can plan the next calendar for upcoming service update CLOUDFRONTS PROTOCOL FOR TRACKING DOWN THE ENVIRONMENT DETAILS We have added the field ERP version in D365 PSA where the project lead will update the version of the production environment. After every update, it is the Project Lead’s responsibility to update this field. Every Monday we have a scheduled recurring management meeting where the CEO, Delivery Head and Practice Lead discuss the status of each project by opening a Project Overview Report developed in Power BI. The same report has the column of ERP version so that the management is aware of the client’s D365 Finance & Operations version. CLOUDFRONTS STEPS FOR KEEPING THE ENVIRONMENT UP TO DATE For each client our support system would have one case created specifically for the updates and it will be assigned to the Project Lead. The Details of the case is as follows: Case name: Environment update – Client name Notes: ERP Environment version details and the next path for service update Follow-up date: Follow-up date would be one month from the current date and till then the case will be on hold. Based on the follow up date system will automatically send the email to the assigned person so that he is intimated to work on the case. Based on this the user needs to check for updates on the LCS and follow the steps based on this document. STEPS FOR APPLYING SERVICE UPDATE – DEV / CLOUD HOSTED Key points: Before applying the service update on UAT, service update must be applied successfully on the Build and Test Environment or Cloud-hosted environment Sequence for applying update on the environment Build and Test Environment / Cloud-hosted environment UAT / Sandbox Production Before applying the service update, all the models should be a build-up The database must be synchronized Check if any AOT (Application Object Tree) objects are under pending changes in VSTS / TFS All the AOT objects should be checked in to VSTS Steps for applying the service update on the development environment are the same as applying to the UAT environment. Hence steps are listed on the next page. STEPS FOR APPLYING SERVICE UPDATE – UAT Go to the LCS -> Select the appropriate projectof the environment Select the UAT appropriate environment-> Click on full details Scroll down to check the latest update. In this part, we will able to see all the latest service updates. Select the appropriate service update on which we have planned to do. Click on View update. Here, we’re taking an example of moving the environment on 10.0.12 Go to Savepackage Click on Select all. Make sure all the packages are selected. Click on Save packageand then give the appropriate Service update name and then click on save the package. It will save all the hotfixes. Wait for a few moments (It can take 5-10 minutes depends on the number of packages are being loaded). After successfully saved the packages, click on Done button Go back to the environment page and then click on Maintain-> Apply updates We had given the name Service Update 10.0.12which should be shown here to apply the update In some cases, the package will not appear suddenly. What to do in such a case? Let’s see the next step on how to verify that. Go to Asset library Click on Software deployable packageand then navigate to our service package Have a look on the column – Valid. If it is not signed with the right symbol then keep patience until it is done. Once the package is validated successfully, we will able to deploy the service update to the environment. After validating the deployable package, we can see the package and just one step away for applying the service update. Click on the Apply button. TESTING – RSAT … Continue reading CloudFronts Dynamics 365 Finance & Operations Update Steps & Protocol
Importing Notes in Dynamics 365 correctly
Preparing an Excel Template for Notes entity is a little tricky. Doesn’t work when you just Export directly as a Template from the Templates Wizard and try to include all columns and import as is. Why? Because there’s no Regarding field exported when you export/import that template. Here’s what you can do as a workaround. Scenario Now, let’s assume you want to Export a standard Excel Template for import so that you can re-import into Dynamics for Notes entity for a regarding entity. Exporting Excel Template Your Document Templates are where all your Excel Templates can be exported from – Now, follow the below – Select Notes entity and Edit Columns you need to Export the Excel with your required columns Select the columns you need. Observe that you don’t get Regarding column to export Then Download the file. Modifying the Excel Now, since you don’t have the Regarding field in the Excel you exported from Templates, here’s what you need to do – Add a column yourself, give it a proper name based on what the Notes’ Parent entity should be. In this example, I’m importing Notes for Account. So, I’m adding a column called ‘Account Name’ A new column will be created as below Now, populate your data based on how the Notes should be imported and tagged to which records. Now, by default, this template is exported in Microsoft Excel Worksheet (xlsx) format. You’ll need to Save As in CSV format Re-Importing Up until above, your Excel is ready to be imported. Let’s begin – Import the file as a usual Excel Import in Dynamics 365 CRM. Since this is not a direct Template importing as is, but a CSV, you’ll get to map this file manually. Then, you’ll need to manually select the Note entity from the drop-down and then proceed Now, whatever is mapped automatically will be mapped. For the newly created Account Name field, you’ll need to expand the Not Mapped dropdown and select Regarding (Lookup) Now, you’ll need to select the entity you want the Notes to appear under. In my case, this is Accounts, so I have it right there Since this Regarding fields supports several entities, scroll all the way down to Confirm your selection Now, your Regarding field is set and you are ready to confirm and Import Now, my Import here is completed. (You’ll need to take care the Import is successful) Imported Notes If you look at the records now, the Notes will be attached to the respective Regarding records Hope this helps!!
Sales return order line registration in D365FO and AX 2012
Introduction: Sales return order line registration in X++ Details: Consider SalesReturnOrderRegisterLine is the table where records are with SalesLine referenced. If we are required to register serialized items than salesReturnOrderRegisterLine.inventSerialId will be considered and if item referred with batch then salesReturnOrderRegisterLine.inventBatchId will be considered. public static void inventoryRegistration(SalesId _salesId) { SalesReturnOrderRegisterLine salesReturnOrderRegisterLine; SalesLine salesLine; TmpInventTransWMS tmpInventTransWMS; InventTransWMS_Register inventTransWMS_Register; InventDim inventDim; InventTrans inventTrans; VendPackingSlipTrans vendPackingSlipTransLoc; InventTransOrigin inventTransOrigin; while select salesReturnOrderRegisterLine where salesReturnOrderRegisterLine.SalesId == _salesId { salesLine = SalesReturnOrderRegister::updateDispositionCode(salesReturnOrderRegisterLine.InventTransId); inventTransWMS_Register = InventTransWMS_Register::newStandard(tmpInventTransWMS); select firstonly inventTrans where inventTrans.StatusReceipt == StatusReceipt::Ordered exists join inventTransOrigin where inventTransOrigin.RecId == inventTrans.InventTransOrigin && inventTransOrigin.InventTransId == salesLine.InventTransId && inventTransOrigin.ReferenceId == _salesId; tmpInventTransWMS.clear(); tmpInventTransWMS.initFromInventTrans(inventTrans); tmpInventTransWMS.InventQty = salesReturnOrderRegisterLine.SalesQty; tmpInventTransWMS.LineNum = int642int(salesLine.LineNum); inventDim = salesLine.inventDim(); inventDim.inventSerialId = salesReturnOrderRegisterLine.inventSerialId; inventDim.inventBatchId = salesReturnOrderRegisterLine.inventBatchId; tmpInventTransWMS.InventDimId = InventDim::findOrCreate(inventDim).inventDimId; tmpInventTransWMS.ItemId = salesLine.ItemId; inventTransWMS_Register.writeTmpInventTransWMS(tmpInventTransWMS, inventTrans, InventDim::find(tmpInventTransWMS.InventDimId)); if (!inventTransWMS_Register.updateInvent(salesLine)) { throw error(“Error during sales return order registration”); } } } Consider SalesReturnOrderRegister is the class which has below static methods public static SalesLine updateDispositionCode(InventTransId _inventTransId) { SalesLine salesLine = SalesLine::findInventTransId(_inventTransId, true); ReturnDispositionCode returnDispositionCode; SalesReturnOrderRegister::runPreReturnOrderRegisterLine(salesLine); salesLine.ReturnDispositionCodeId = returnDispositionCode.DispositionCodeId; salesLine.update(); return salesLine; } public static void runPreReturnOrderRegisterLine(SalesLine _salesLine) { InventTransOriginId salesLineInventTransOriginId; InventTransOriginId reservationLineInventTransOriginId; SalesLine reservationLine; ReturnDispositionCode returnDispositionCode; if (_salesLine.ReturnStatus == ReturnStatusLine::Awaiting) { if (!_salesLine.ReturnAllowReservation && _salesLine.isStocked()) { SalesLine::changeReturnOrderType(_salesLine.InventTransId); _salesLine = SalesLine::findInventTransId(_salesLine.InventTransId, true); } select firstOnly returnDispositionCode where returnDispositionCode.DispositionAction == DispositionAction::Credit; _salesLine.ReturnDispositionCodeId = returnDispositionCode.DispositionCodeId; _salesLine.update(); } else if (_salesLine.ReturnStatus == ReturnStatusLine::Registered) { select forupdate firstonly reservationLine where reservationLine.InventRefTransId == _salesLine.InventTransId; if (reservationLine || _salesLine.qtyMarked()) { if ((_salesLine.returnDispositionCode().DispositionAction == DispositionAction::ReplaceScrap || _salesLine.returnDispositionCode().DispositionAction == DispositionAction::ReturnToCust || _salesLine.returnDispositionCode().DispositionAction == DispositionAction::Scrap)) { if (reservationLine.SalesQty == reservationLine.RemainSalesPhysical) { reservationLineInventTransOriginId = InventTransOriginSalesLine::findInventTransOriginId(reservationLine.DataAreaId, reservationLine.InventTransId); salesLineInventTransOriginId = InventTransOriginSalesLine::findInventTransOriginId(_salesLine.DataAreaId, _salesLine.InventTransId); InventTransOrigin::deleteMarking(salesLineInventTransOriginId, reservationLineInventTransOriginId, -_salesLine.QtyOrdered); reservationLine.delete(); } } else { throw error(“@SYS332911”); } } } } Thanks for reading and stay connected with us for more updates!!! Jagdish Solanki | Senior Technical Consultant | CloudFronts Business Empowering Solutions Team “Solving Complex Business Challenges with Microsoft Dynamics 365 & Power Platform”