Workaround to ‘Edit in Excel’ functionality with Import/Export using Excel Buffer in Business Central
Problem Definition: When working with ‘Edit In Excel’ functionality in Business Central, there was an error( https://github.com/Microsoft/AL/issues/4060 ) when the page fields were modified using extensions. Introduction: Excel Buffer is one of the feature that is widely used to Import & Export data to and from Excel Sheets. With NAV evolving to Business Central, few of the existing functions are deprecated and cannot be used in AL Extensions. Pre-requisites: Microsoft Dynamics 365 Business Central Demonstration: 1. Excel Buffer Import: In this code, total rows and columns to be imported is found, then each field is stored as ‘CellValue’ in new records in Excel Buffer. Thus, I’ve used GetValueAtIndex(Row,Column) function to get the exact ‘CellValue’. 2. Excel Buffer Export: Conclusion: In this blog, I’ve demonstrated how to use Excel Buffer for Import/Excel of Excel from a table using AL Extensions. NOTE: Code is located( https://github.com/olisterr/ExcelBufferImportExportforBC )
Share Story :
Error handing in MS Flows
Introduction: In this blog we will be going through the steps of Error Handling in Microsoft Flows. Implementation: Step 1: We have created a basic flow that is triggered when a HTTP POST Request has be made to the generated URL. The body will contain a JSON array with some data The flow will then take the data passed in the POST request body and for each object in the JSON array, it create a record in Dynamics 365 Customer Engagement as shown below. In the above scenario we pass the correct data, but in case the data that is passed to the URL is not correctly formatted or the data is missing we will encounter an error and the flow will fail. To handle such situations we will define an action that will take place when an error is encountered. Step 2: To Log the error, we will create another action to create a log error log in Dynamics 365 Customer Engagement. To make sure that this is created only when an error is encountered we click on the Configure Run After option as shown There are four options shown, here we select only the “has failed” option which states that the log will be created when there is a failure. Once this is done we can see the the flow shows a dotted red line for the last step, this is because the “Log Error in CRM” action will run only in one scenario i.e. when the above action has failed. The benefits of using this approach in our flows is that we can log all the errors at one place and also store the error response of the previous stage by simply selecting the Dynamic Content in the “Log Error in CRM” action.
Share Story :
Update field value based on the current stage of Business Process Flow and trigger workflow when Business Process Flow is finished.
Introduction: This blog explains How to Update field value based on the current stage of Business Process Flow. How to Trigger workflow when Business Process Flow is finished. PART A: Scenario: We have a custom Business Process Flow with 4 stages on Order entity. Whenever user changes the stage of Business Process Flow status field is updated. (we have created custom status field named as printing status). Steps to be followed: 1. Create Real time Workflow on Business Process Flow Entity. 2. Trigger workflow on Process Changes: 3. Add Step –> Update Record. Update the field value with active BPF stage. 4. Create another real time workflow on Order entity. 5. Trigger on Record Field Change and select the field where you are updating the stage value. 6. Add Step –> Check Condition and Update the field value. (check the stage field value and update the status accordingly ) For example first stage in BPF is waiting for jersey then we will check if Current stage is equal to waiting for jersey then update the printing status to waiting for jersey. Complete Workflow: PART B: How to Trigger workflow when Business Process Flow is finished. Scenario: Update the Order Status to fulfilled when Business Process Flow is finished. Steps to be followed: 1. Create a Real time and on demand workflow on Order entity. 2. Add Step -> Change Status to complete 3. Activate the workflow. 4. Go to Business Process flow which you are using and perform the below steps: a. Drag and Drop the workflow in Global Workflow. b. Trigger the workflow on when process is completed and select the workflow which you have created. (you will only see on demand workflows)
Share Story :
Customer Approval In Business Central Using MS Flows
Introduction: Microsoft Flows is a cloud-based software tool that allows to create and automate workflows across multiple applications. Here, I have created a flow for Customer Approval using MS Flows, where a customer which is created in Business Central can be notified to the particular user using Outlook. Pre-Requisites: Microsoft Dynamics 365 Business Central MS Flows Procedure: 1)First you need to do the SMTP Mail Setup from the Business Central to send the notification. 2) Go to MS Flows, select Create from blank to create a new flow. 3) From the list of connectors, select the Business Central Connector and in Trigger select “When a Customer Approval is Requested”. 4)Select the Business Central Company and add the conditions you want to add for Customer Approval. 5) Add the action or condition to be executed on the trigger. 6) Here, I have added the Outlook action to send a mail to the admin when a customer is created. 7) A Customer is created in Business Central and when we click on Send Approval Request for Customer Approval, a mail is sent to the particular person in outlook mail.
Share Story :
Posting Restriction for Journals- Dynamics 365 Finance & Operations
Posting restriction feature allow to determine whether specific user or user groups can post only journals that they create. You can use Journal names for posting restriction setup. Navigate to General ledger > Journal Setup > Journal names. Select Journal names for which you want to apply Posting restriction. Click on Posting restrictions button To set up posting restrictions by user group, select By user group.Select the check box next to the user group name. To set up posting restrictions by user, select By user. Select the check box next to the user name. Click OK to apply the restrictions and close the form.
Share Story :
PSA – Create Time Entry Delegations for all resources
Background: One of the frequent requests we continuously get from our clients is for someone else to do Time entries on behalf of other resources. We know that this can be done using Delegations feature in Dynamics 365 PSA. You can read more about delegations here written by another D365 PSA Expert – Priyesh Wagh : Delegating Time Entries in D365 PSA Example: But if we want to do this for all the Resources, then it is tedious and not practical to ask each resource to create delegate. For example, on of our clients requested that HR should be able to enter Time entry on behalf of any resource in the organization. I also saw that many organizations need a feature like this. So I thought of creating a console application which will get all the Bookable resources of type User and create Delegations. Below is the code that you can use to create delegations for all users in the organization. You can use the same code to create a plugin if you want to automatically create delegate on creation of Bookable resource. Sample Code: You can get the entire code from my Github #region Create Delegations for all User Bookable Resources to Particular person foreach (Entity bookableResource in userBookableResources.Entities) { Entity TimeEntryDelegation = new Entity(“msdyn_delegation”); TimeEntryDelegation[“msdyn_delegationfrom”] = new EntityReference(“bookableresource”, bookableResource.Id); TimeEntryDelegation[“msdyn_delegationto”] = new EntityReference(“bookableresource”, DelegateToId); TimeEntryDelegation[“msdyn_startdate”] = new DateTime(2018, 10, 1); TimeEntryDelegation[“msdyn_enddate”] = new DateTime(2022, 12, 31); TimeEntryDelegation[“msdyn_type”] = new OptionSetValue(192350000); //Time Entry TimeEntryDelegation[“msdyn_name”] = string.Format(“Delegation to HR for {0}”, bookableResource.GetAttributeValue<string>(“name”)); try { Guid DelegationId = _client.Create(TimeEntryDelegation); } catch (FaultException<OrganizationServiceFault> ex) { Console.WriteLine(“Resource: ” + bookableResource.GetAttributeValue<string>(“name”) + ” Error: ” + ex.Message); } } #endregion Note: Please note that the “Delegate to” Resource/ User should also have Delegate role in order to be able to do time entry on behalf of others. If not, then you will face below error:
Share Story :
Contract Invoice Schedule Status Change on Invoice Actions
Stages of Invoice Schedules are changed behind the scenes as you perform actions on the Invoice of the Contract. Let’s see what we have got here – So, when an Invoice Schedule is Ready for Invoicing, it will be considered in the Invoice you’ll end up creating. Now, if you create the Invoice for that Contract (shown below) The status now changes to Customer invoice created. And, when you mark that Invoice as Confirm, shown below – The Invoice schedule record’s Invoice Status will be changed to ‘Customer invoice posted’ Pretty straight forward!
Share Story :
Power BI Transport Layer Security Settings (TLS)
Introduction: The Transport Layer Security (TLS) is a protocol that provides Secure communications. There are different versions of this protocol with the latest one being TLS 1.2. With all the crazy updates that Microsoft comes with, many of the programs, web services. etc. have enforced TLS 1.2 to be mandatory for communicating over the network. The previous versions of TLS are not supported in many of these programs and sooner or later they will deprecate for sure. Lucky for us, after the October 2018 update, Power BI Desktop now respects this need for TLS 1.2 and recognizes the Windows registry key in your System. You can enable or disable which version of TLS protocol is needed and Power BI will use that version accordingly. Steps to disable older TLS: Open your regedit by searching for ‘regedit’ in the search box of the taskbar Note: Changes in the regedit can cause serious changes in your system. Please take a backup of your regedit before proceeding and import the backup just in case your system starts to act funny. Go to [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client] and make the following changes [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client] “Enabled”=dword:00000000 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client] “DisabledByDefault”=dword:00000001 This will disable your Power BI from using your older version of TLS 1.0 by default Steps to update your TLS to 1.2 Go to [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client] and make the following changes [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client] “Enabled”=dword:00000001 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client] “DisabledByDefault”=dword:00000000 This will enforce your applications to use the latest TLS Power BI Desktop will respect the registry keys specified on those pages, and only create connections using the right version of TLS. For further documentation on TLS, you can refer the microsoft document below https://docs.microsoft.com/en-us/windows-server/security/tls/tls-registry-settings
Share Story :
Move Attachments from Tracked Email to SharePoint using Microsoft Flow
Introduction: Microsoft flows can be used to automate many workflows across multiple applications and services. This is basically designed for non-developers. To create a flow, the user specifies what action should take place when a specific event occurs. In this blog, we will have a look on how we can add the attachments from the emails that are tracked in Dynamics 365 CRM to SharePoint Systems included in Document Integration D365 App for Outlook SharePoint Dynamics CRM Online V9 Note: We have taken Opportunity tracked Emails for this example, you can work on any entity. Let’s start with the steps that should be undertaken to achieve the above requirement. Step 1: Create a blank Flow template. Choose the Dynamics 365 Connector and trigger as, “When a record is created”. Select your Organization Name, and the entity, in our case it is Email Messages. Step 2: Add condition to check whether the email is related to Opportunity and whether it has Status Reason as Received. By default, the condition you can specify is basic. Change in to Advance mode and add the below formula Formula used: @and ( equals(triggerBody()?[‘_regardingobjectid_type’], ‘opportunities’), equals(triggerBody()?[‘_statuscode_label’], ‘Received’) ) Step 3: For the true part of the condition, retrieve the Opportunity record to which the Email is tracked. The reason behind retrieving Opportunity Name is to create SharePoint Folders. Folders will be created on the format Topic_OPPORTUNITYGUID. Step 4: Now let us retrieve all the Activity Mime Attachments associated with the Email Message that is created. There are two Attachments entities available for the selection. The first one is the Attachment entity The second one is the Activity Mime Attachment entity. Step 5: Retrieve Attachment related to the Activity Mime Attachment for the Body and File Name of the attachments. Now steps to check the presence of Document Location starts Step 6: Retrieve the Document Locations for the current opportunity record to see if there is an already defined path or not. Select “List Records” action and enter below fields Step 7: After retrieving the Document Location records, verify the length of the records in the collection. Formula used : length(body(‘Retrieve_Document_Locations’)?[‘value’]) Step 8: For the true part of the condition, follow the below steps: Step 8.1: Select connector as SharePoint and select Create file Action. Enter all the details listed below: 1) Site Address: The SharePoint Site Address 2) Folder Path: The path where the file need to be stored. i.e. /opportunity/Topic_ toUpper(replace(body(‘Get_record’)?[‘opportunityid’],’-‘,”)) For Example the folder Name will be : Topic_E608E808F4A1E811A977000D3A37051A 3) File Name: Name of the file 4) File Content: The attachment body Step 8.2: Delete the Attachment record from the Dynamics CRM Email message. Here you need to select the first option of Attachments from the list. Step 9: For the false part of the condition below are the steps you should follow: Step 9.1: Create a file in SharePoint. Refer Step 8.1 Step 9.2: Retrieve the Parent Document Location. This is needed as we are creating the document location by ourselves. Step 9.3: Create the Document Location record for the record that was just processed. Parent Site or Location: This is the GUID of the parent Doucument Location retrieved in Step 9.2 Relative URL formula: replace(replace(body(‘Create_file_3’)?[‘Path’],’/opportunity/’,”),concat(‘/’,body(‘Create_file_3’)?[‘Name’]),”) Step 10: Delete the Attachment record from the Dynamics CRM Email message. Here you need to select the first option of Attachments from the list. Now you can test by sending email and tracking to Opportunity in D365 App for Outlook in Dynamics CRM. Document will be uploaded to SharePoint with specified location.
Share Story :
Vendor Invoice Journal-Dynamics 365 Finance and Operations
Introduction: Vendor invoice journal helpful to post purchase invoices that are not associated with purchase orders. Examples of this type of invoice include expenses for supplies or services. Steps: Go to Accounts Payable > Invoices > Invoice journals Click on new button, select name of the journal and enter a description in description field. In the Date field, enter the posting date that will update General Ledger. Select Vendor account Specify invoice number in Invoice field. Enter Description in the field description In the Credit field, enter a number. In the Offset account field, enter the account number or click the drop down button to open the lookup Click on Validate to check the data are correct. Click on post to Post the Invoice