Power Automate: “Set Variable” Action fails inside “Switch” Action

Recently, we were working on Power Automate where we were supposed to set a variable for further use based on the value of an option set field in an entity. We used Switch action and inside Case block we were trying to set the variable as shown below: While executing the Power Automate, unfortunately, we … Continue reading Power Automate: “Set Variable” Action fails inside “Switch” Action

Azure Function: Web Deploy cannot modify the file on the Destination because it is locked by an external process

Recently, while deploying Azure Function from Visual Studio, we got an error "Web Deploy cannot modify the file on the Destination because it is locked by an external process". To fix this issue, we created an application setting. There are 2 ways to do this: Create an Application Setting in the Function App in Azure … Continue reading Azure Function: Web Deploy cannot modify the file on the Destination because it is locked by an external process

PowerAutomate: Perform “Group By” operation on Data

In this post, we'll see how we can perform aggregate function on data such as Sum or Count using PowerAutomate. Unlike LINQ in C# or SQL, it's not very straight forward to do using PowerAutomate for which I thought of sharing the approach we had taken. Recently, we got a requirement to calculate the sum … Continue reading PowerAutomate: Perform “Group By” operation on Data

PowerAutomate: Self-reference is not supported when updating the value of variable

We often come across requirements in which we want to add certain value to the same variable e.g. for integer variable, x=x+5 or for string variable, test=test+"additional". We were trying to achieve the same thing using PowerAutomate. However, while doing this using Set Variable action, we got an error saying "Self-reference is not supported when … Continue reading PowerAutomate: Self-reference is not supported when updating the value of variable

D365 CE: Error while activating BPF “An attribute with the specified name already exists. Exception Message: Column names in each table must be unique. Column name ‘stageid’ in table ‘EntityName’ is specified more than once.”

Recently, while activating a Business Process Flow, we got below error: "An attribute with the specified name already exists. Exception Message: Column names in each table must be unique. Column name 'stageid' in table 'EntityName' is specified more than once." While checking the entity metadata for which we had created BPF, we found that Business … Continue reading D365 CE: Error while activating BPF “An attribute with the specified name already exists. Exception Message: Column names in each table must be unique. Column name ‘stageid’ in table ‘EntityName’ is specified more than once.”

D365 CE: Get Logged in User’s Security Roles using JavaScript

Many times we come across requirements such as show/hide ribbon buttons based on logged in user's security role. Earlier, we used to get security roles of logged in user at client side using Xrm.Utility.getGlobalContext().userSettings.securityRoles which used to return array of GUID value of each security role. Now that it's deprecated, we can use Xrm.Utility.getGlobalContext().userSettings.roles which … Continue reading D365 CE: Get Logged in User’s Security Roles using JavaScript

D365 CE: Show/Hide and Enable/Disable same field placed in multiple tabs using JavaScript

We often put the same fields in different tabs based on business requirements. To Hide/Show such fields we need to use below script: var formContext = executionContext.getFormContext(); formContext.getAttribute("fieldName").controls.forEach( function (control, i) {      control.setVisible(false/true); }); Similarly, to Enable/Disable such fields we need to use below script: formContext.getAttribute("fieldName").controls.forEach( function (control, i) { control.setDisabled(false/true); }); Without … Continue reading D365 CE: Show/Hide and Enable/Disable same field placed in multiple tabs using JavaScript

D365: Implement Try…Catch…Finally in PowerAutomate

Recently, we were working on a requirement to send PDF as an attachment in email on click of a custom ribbon button on Lead record. More details here:D365: Generate Word Document using Content Control, save to SharePoint and convert to pdf using PowerAutomateD365: Download SharePoint document, attach to Email using PowerAutomate and Azure FunctionD365: Execute PowerAutomate from … Continue reading D365: Implement Try…Catch…Finally in PowerAutomate

D365: Execute PowerAutomate from Ribbon button using JS

Recently, we had a requirement to execute PowerAutomate on click of a button on Lead record. In this post, we'll see how to do that. While creating the PowerAutomate, select the trigger as "When an HTTP request is received" as shown below: We can pass parameter to the PowerAutomate in JSON format. In this example, … Continue reading D365: Execute PowerAutomate from Ribbon button using JS

D365: Download SharePoint document, attach to Email using PowerAutomate and Azure Function

In this post, we had discussed how to upload document to SharePoint using PowerAutomate. Here, we'll discuss how to download that document and attach it to an email activity. We'll extend the same PowerAutomate we were using in the previous post and will also see how to execute HTTP Triggered Azure Function from PowerAutomate. So, … Continue reading D365: Download SharePoint document, attach to Email using PowerAutomate and Azure Function

D365: Post custom message to Session Enabled Service Bus Queue C#

In one of my previous posts, https://ajitpatra.com/2019/12/09/d365-post-custom-message-to-azure-service-bus-queue-c/, we had gone through how to post custom message to a service bus queue. In this post, we'll see how we can post the same message to a session enabled queue. We have to make few lines of code changes in PostMessageToServiceBusQueue method of this post as shown … Continue reading D365: Post custom message to Session Enabled Service Bus Queue C#

D365: Generate Word Document using Content Control, save to SharePoint and convert to pdf using PowerAutomate

In this post, we'll see how we can generate word document using content controls and PowerAutomate. We'll save the generated document in appropriate folder in Sharepoint so that it shows up on the appropriate Lead record. Then, we'll convert the word document to pdf document and store at the same location. To proceed, let's create … Continue reading D365: Generate Word Document using Content Control, save to SharePoint and convert to pdf using PowerAutomate

PowerApps: ModelDrivenFormIntegration control not available on App Start

Recently, we were working on embedded canvas app on Contact entity form. The requirement was to show related records of the Contact record based on certain condition when the App is started. We created the App in make.powerapps.com and created an Azure Function which will take input as GUID of Contact record and will return … Continue reading PowerApps: ModelDrivenFormIntegration control not available on App Start

Using Service Bus Triggered Azure Durable Function with D365 CE

In this post, we'll see how we can use Service Bus triggered Azure Durable Function with D365 CE to perform CRUD operation. Requirement: When Rate Amount(custom field) field changes in Rate(custom entity) record, update Rate(custom field) field on related(Revenue Schedule Line(custom entity)) records of the corresponding Rate record. Of course, there are multiple ways to … Continue reading Using Service Bus Triggered Azure Durable Function with D365 CE

D365: Service Bus Triggered Function Error: Cannot bind parameter ‘parameterName’ to type MessageReceiver. Make sure the parameter Type is supported by the binding

Recently, we were working on Service Bus Triggered Azure Durable Function. After writing the necessary code, we deployed the Durable Function to Azure. After deploying, while trying to test the function, we faced one weird issue saying "Error: Microsoft.Azure.WebJobs.Host: Error indexing method 'AzureFunctionName'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'parameterName' to type MessageReceiver. Make sure the parameter … Continue reading D365: Service Bus Triggered Function Error: Cannot bind parameter ‘parameterName’ to type MessageReceiver. Make sure the parameter Type is supported by the binding

D365: Service Bus Triggered Function error: Connection string ‘AzureWebJobsServiceBus’ is missing or empty

Recently, while working on Service Bus triggered Azure Durable Function, we got an error saying "The function runtime is unable to start. Microsoft.Azure.WebJobs.ServiceBus: Microsoft Azure WebJobs SDK ServiceBus connection string 'AzureWebJobsServiceBus' is missing or empty". Below is the code that we were using: [FunctionName("UpdateGlobalRatesOnRSLs")] public static async Task Run([ServiceBusTrigger("%QueueName%")] Message message, MessageReceiver messageReceiver, string lockToken, … Continue reading D365: Service Bus Triggered Function error: Connection string ‘AzureWebJobsServiceBus’ is missing or empty

D365: “Access denied. You do not have permission to perform this action or access this resource” while calling SharePoint API from plugin/custom workflow

Recently, we were working on calling SharePoint API from plugin. While getting the access token we received the following error: "Access denied. You do not have permission to perform this action or access this resource". To fix this issue, we gave appropriate permission to the Application we had created in SharePoint for Server to Server … Continue reading D365: “Access denied. You do not have permission to perform this action or access this resource” while calling SharePoint API from plugin/custom workflow

D365: Call SharePoint API from plugin/custom workflow C# – Part 2

In the previous post, we saw how to create an app in SharePoint and give necessary permission. In this post, we'll see how to use the app details in C# to connect to SharePoint API. We can use the below code to get the access token: private static string TENANT_ID; private static string CLIENT_ID; private … Continue reading D365: Call SharePoint API from plugin/custom workflow C# – Part 2

D365: Call SharePoint API from plugin/custom workflow C# – Part 1

In this series of post, we'll see how we can call SharePoint API from plugin or custom workflow using C# to retrieve number of documents uploaded to SharePoint for a particular record, albeit we can do any other operation connecting to SharePoint API. To use SharePoint API, we need to create an Application in SharePoint … Continue reading D365: Call SharePoint API from plugin/custom workflow C# – Part 1

D365: Enable Rule for button with asynchronous API request using promise

Many times, we get requirement to show/hide a button based on certain condition for which we define Enable Rule in Ribbon Workbench. If we need javaScript code for evaluation then we use Custom Enable Rule mentioning library, method to execute, passing PrimaryControl CRM parameter and additional parameters if necessary. Sometimes, the evaluation is done real … Continue reading D365: Enable Rule for button with asynchronous API request using promise

D365: “The user is not a member of the organization” error while connecting to CE

Recently, we were working on connecting to CE to do some CRUD operation using Azure function. We were using Client ID(Application ID) and Client Secret of the app registered on Azure Active Directory. We had provided the necessary API(Dynamics CRM) Permission (delegated "user_impersonation") to the app. While running the Azure function, we were getting the … Continue reading D365: “The user is not a member of the organization” error while connecting to CE

Power Automate: The template validation failed: ‘The repetition action(s) referenced by ‘inputs’ in action are not defined in the template.’

Recently, while working on Power Automate(formerly known as Flow), we got an issue saying "The template validation failed: 'The repetition action(s) referenced by 'inputs' in action are not defined in the template." We were trying to use Set Variable action at 2 places inside a loop based on certain condition as shown below: To save … Continue reading Power Automate: The template validation failed: ‘The repetition action(s) referenced by ‘inputs’ in action are not defined in the template.’

D365: The webhook call failed because the http request received non-success httpStatus code

Recently, while trying to invoke webhook using custom global action we got an error saying "The webhook call failed because the http request received non-success httpStatus code. Please check your webhook request handler." We were using JS to call a custom global action which was used to invoke webhook which in turn was used to … Continue reading D365: The webhook call failed because the http request received non-success httpStatus code

D365: Azure Durable Function with D365 CE – Part 3

In the previous post, we saw how we can implement durable function for CRUD operation in D365 and test it using Postman. In this post we'll see how we can parameterize durable function so that we can pass parameters from external system to durable function and process it further. Let's take a simple example as … Continue reading D365: Azure Durable Function with D365 CE – Part 3

D365: Azure Durable Function with D365 CE – Part 2

In the previous post, we saw how we created the default template of durable function. In this post, we'll modify that to do some CRUD operation in D365 CE. For demo purpose, let's pick a simple scenario i.e. Retrieve related records(accommodation payments) of a particular Contact record and update their field(Expected Refund Due Date a … Continue reading D365: Azure Durable Function with D365 CE – Part 2

D365: Azure Durable Function with D365 CE – Part 1

In this series of post, we'll see how we can use Azure Durable function(an extension of Azure Function which works on durable task framework) with D365 CE. We can find more details about Durable functions, it's application patterns, pricing and the way it works here: https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-overview. This series of post is divided into 6 parts:Part … Continue reading D365: Azure Durable Function with D365 CE – Part 1

USD 4.1: Implementing Click to call functionality for making outgoing calls

In this post, we'll see how we can implement click to call functionality i.e. clicking on a phone number field on the form to make outgoing call inside USD. NOTE: In our scenario, we have implemented custom CTI adapter to use web services of telephony provider to make the outgoing calls. Below are the steps … Continue reading USD 4.1: Implementing Click to call functionality for making outgoing calls

USD 4.1: Using CTI Simulator and Generic Listener

In this post, we'll see how we can use CTI simulator along with Generic Listener provided by Microsoft. To start, download the CTI simulator from the following location: https://onedrive.live.com/?authkey=%21AIN2jgKztrYGpok&cid=5A34CCE9728C8F4F&id=5A34CCE9728C8F4F%21274&parId=5A34CCE9728C8F4F%21169&action=locate. Unzip it. Open the solution file in Visual Studio and compile it. Open the Project folder. Navigate to bin--> Debug folder and locate the USDCTICallTester.exe as … Continue reading USD 4.1: Using CTI Simulator and Generic Listener

D365: ExecuteMultiple error EntityState must be set to null, Created (for Create message) or Changed (for Update message)

While working on bulk update recently, we got an error saying "EntityState must be set to null, Created (for Create message) or Changed (for Update message)" in the ExecuteMultipleResponse object. We were trying to update one attribute of a set of records and below is the piece code we were using to do bulk update: … Continue reading D365: ExecuteMultiple error EntityState must be set to null, Created (for Create message) or Changed (for Update message)

D365: Unable to delete entity having hidden dependency(with Canvas App)

Recently, we were trying to delete one entity(not that heavily customized) as we wanted to use a different attirbute as Primary field from what being currently used, in our DEV instance.We removed all possible dependency for deleting the entity by clicking on Entity -> Show Dependencies in the solution. After removing all the dependencies, when … Continue reading D365: Unable to delete entity having hidden dependency(with Canvas App)

D365: 0x80040203 Invalid Argument error below lookup field

Recently, we were working on applying lookup filtering using JS on a custom entity form. While testing it, we got an error on each key press on the lookup field "0x80040203 Invalid Argument". We were constructing the record filter criteria based on certain condition. While debugging the code, we found that the filter criteria(FetchXML filter … Continue reading D365: 0x80040203 Invalid Argument error below lookup field

Microsoft Flow: Using data returned from N:N relationship for further action

In the previous blog, we saw how to retrieve N:N records i.e. we retrieved the related "Rate" records of a particular "Revenue Schedule Line". In this blog, we'll see how to process the data returned for further action. From our previous example, we wanted to loop through each related "Rate" record of "Revenue Schedule Line" … Continue reading Microsoft Flow: Using data returned from N:N relationship for further action

Microsoft Flow: Retrieve N:N records in D365

In this blog, we'll see how we can retrieve N:N records using Microsoft Flow. Below are the steps: Go to https://flow.microsoft.com and login. After successful login select CDS connector. For demo purpose, let's select "When record is updated" as the trigger point. Select Organisation, Entity Name and Scope as shown and click New Step. Search … Continue reading Microsoft Flow: Retrieve N:N records in D365