Sam's Microsoft Dynamics 365 Blog

Thursday, 22 May 2025

How to Get the Power Automate Flow Run URL Using Expressions

In many Power Automate projects, especially those involving approvals, error handling, or audit logs, it’s helpful to have a direct link to the current flow run instance. This is particularly useful for debugging or sending links to business users or admins to investigate failures.

In this blog post, I’ll show you how to generate the current Flow Run URL using a simple concat() expression in Power Automate.

๐ŸŽฏ Objective

We want to dynamically construct a URL like this during a flow run:

https://us.flow.microsoft.com/manage/environments/{EnvironmentId}/flows/{FlowId}/runs/{RunId}

You can then include this in an email notification, Microsoft Teams post, or Dataverse log for auditing and support purposes.

๐Ÿงช The Expression

Here’s the expression you can use in Power Automate:

concat('https://us.flow.microsoft.com/manage/environments/', workflow().tags.environmentName, '/flows/', workflow().name, '/runs/', workflow().run.name)

๐ŸŒ Replace us.flow.microsoft.com with the correct region URL if you are in a different geography (e.g., europe.flow.microsoft.com).


๐Ÿ›  Step-by-Step Guide

๐Ÿ“ Step 1: Create a Flow

  • Create an automated flow or manual flow.

  • Add a trigger like "Manually trigger a flow" or "When a record is created."

๐Ÿ“ Step 2: Add a Compose Action to Build the Flow Run URL

  1. Click + New Step.

  2. Select Compose.

  3. In the Inputs field, paste the expression:

        concat('https://us.flow.microsoft.com/manage/environments/', workflow().tags.environmentName, '/flows/', workflow().name, '/runs/', workflow().run.name)




๐Ÿ“ Step 3: Test the Flow

  1. Save and run the flow.

  2. Go to the Run history.

  3. Click on the latest run → Expand the Compose action.

  4. You’ll see the full Flow Run URL generated dynamically.





๐Ÿ“ Step 4 (Optional): Use in Email or Teams Notification

To make this link useful, add it to an email or message like this:

In Send an Email (V2):


Hi,

The flow has completed. You can view the run here:
@{outputs('Compose')}




✅ Benefits

  • Great for debugging failed runs

  • Helpful in audit trails or support processes

  • Can be stored in Dataverse, SharePoint, or sent via Teams


๐Ÿง  Final Thoughts

With just a single expression, you can make your flows much more transparent and easier to monitor. The next time something fails—or just finishes successfully—you’ll have a clickable link directly to that specific run.

Thanks for reading this article. Hope this Article will help you. Cheers!!!

Monday, 28 August 2023

Web Resource vs PCF vs Canvas App - which of the one is used?

While started working on specific Business Requirements related to custom layout, there is a always common question that "where to start, which of the component needs to use?", so explaining component in brief to get an idea for the particular Business Requirements.


  • PCF (PowerApps Component Framework): PowerApps Component Framework (PCF) is a technology within the Microsoft Power Platform that allows developers to create custom components for use within Canvas Apps, Model-Driven Apps, and even in the Unified Interface of Dynamics 365. PCF enables you to create custom UI controls using familiar web development technologies like HTML, CSS, and JavaScript. These components can then be embedded into various app types and interact with data and events.


  • Canvas App: Canvas Apps are a part of the Microsoft Power Platform that enables you to create custom applications with a visual interface. These apps are typically built by users who may not have deep coding skills, as they rely on a drag-and-drop interface to design screens and logic. Canvas Apps allow you to connect to various data sources, including databases, SharePoint lists, and other services, and then build user interfaces and workflows using a visual designer. They can incorporate various controls and elements to create interactive user experiences.


  • Web Resource: A Web Resource is a concept primarily used in the context of Dynamics 365 and Power Apps to include custom web content within an application. A web resource can consist of HTML, JavaScript, CSS, or other web-related files. These resources can be used to extend the functionality of the platform by embedding custom UI elements, scripts, or even external web content directly within an application's user interface.


In summary:

  • PCF is a way to create custom UI components that can be used in various app types within the Power Platform.
  • Canvas Apps are custom applications with visual interfaces created using a drag-and-drop design approach.
  • Web Resources are used to include custom web content or scripts within Dynamics 365 or Power Apps.

The choice between these technologies depends on your specific requirements and your level of coding expertise. If you're looking to create custom UI components with more complex interactions, PCF might be the way to go. For building full-fledged applications with a visual interface, Canvas Apps could be the better choice. And if you need to include custom web content or scripts within your application, Web Resources can help you achieve that.

 

References:



Thanks for reading this article. Hope this Article will help you. Cheers!!!

Friday, 23 June 2023

Portal Revolution : ADX Portal, Dynamics Portal, PowerApps Portal, and Power Pages

ADX Portal, Dynamics Portal, PowerApps Portal, and Power Pages are all Microsoft technologies related to building web portals and applications. Here's a brief overview of each:


ADX Portal: ADX (Adxstudio) is a web portal framework that was acquired by Microsoft and integrated into Dynamics 365 Customer Engagement. It provides a platform for building and customizing web portals that can interact with Dynamics 365 data. ADX Portals are typically used for customer self-service portals, partner portals, or community portals.



Dynamics Portal: Dynamics Portal refers to the web portal functionality that is included in the Dynamics 365 suite of business applications. It allows organizations to create and customize portals for various purposes, such as customer support, employee self-service, or vendor management. Dynamics Portal provides integration with Dynamics 365 data and allows users to access and interact with relevant information.



PowerApps Portal: PowerApps Portal is a component of the Microsoft Power Platform, which includes PowerApps, Power Automate (formerly Flow), and Power BI. PowerApps Portals allow you to build externally facing websites or portals that provide access to data and processes from various sources, including Dynamics 365, SharePoint, and custom connectors. It provides a low-code environment for designing and deploying portals.



Power Pages: Power Pages is not a specific Microsoft product or technology. It might refer to a feature or concept related to the Power Platform or PowerApps, but without further context, it is challenging to provide specific information. If you can provide additional details or clarify your question, I would be happy to assist you further.



In summary, ADX Portal and Dynamics Portal are related to building web portals that integrate with Dynamics 365, while PowerApps Portal is a broader platform for creating portals with data integration capabilities. Power Pages requires more information to provide a specific answer.


Thanks for reading this article. Hope this Article will help you. Cheers!!!

Model-Driven App, Canvas App, and Power Pages

Model-Driven App, Canvas App, and Power Pages are all components of Microsoft Power Apps, a low-code development platform.

Each of these app types has its own characteristics and best use cases. Here's a brief overview of each:


Model-Driven App:

Model-Driven Apps are built around data models and provide a structured way to interact with complex data sets. They offer a more guided and structured user experience by leveraging the Common Data Service (CDS)/Dataverse or a custom data model. Model-Driven Apps provide pre-built components like forms, views, charts, and dashboards that are automatically generated based on the underlying data model. These apps are suitable for scenarios that involve working with structured data and require a higher level of customization and automation.


Canvas App:

Canvas Apps provide a highly customizable and flexible development experience, allowing you to design apps from scratch using a drag-and-drop interface. With Canvas Apps, you have complete control over the layout and functionality of the app. You can create responsive designs, integrate with various data sources, and leverage a wide range of controls and formulas to build the app logic. Canvas Apps are suitable for scenarios that require a high level of customization and flexibility, especially when working with multiple data sources or external APIs.


Power Pages:

Power Pages is a relatively newer concept introduced in Microsoft Power Apps. Power Pages combine the capabilities of both Model-Driven Apps and Canvas Apps, offering a hybrid approach. They provide a structured data model like Model-Driven Apps, but also allow for custom layout and design like Canvas Apps. Power Pages enable you to design rich pages using the app designer interface, combining pre-built components and customizations. They provide a balance between structured data modeling and flexible app design, making them suitable for a wide range of scenarios.



In summary, Model-Driven Apps are ideal for working with structured data and require extensive customization and automation. Canvas Apps offer maximum flexibility and customization options, while Power Pages provide a hybrid approach combining the best of both Model-Driven Apps and Canvas Apps. The choice between these app types depends on the specific requirements of your application and the level of control and customization you need.


Thanks for reading this article. Hope this Article will help you. Cheers!!!

Wednesday, 14 June 2023

Integrate ChatGPT with PowerApps using Power Automate

ChatGPT is an advanced language model developed by OpenAI. It is specifically designed to generate conversational responses and engage in text-based dialogue. It belongs to the GPT (Generative Pre-trained Transformer) family of models. 

GPT models are based on the Transformer architecture, which is a deep learning model architecture known for its ability to process and generate sequences of data, such as text. These models have been pre-trained on large amounts of text data from the internet, allowing them to learn patterns, language structures, and context.

ChatGPT leverages this pre-training to understand and generate human-like text in a conversational manner. It has been trained on a diverse range of conversations and dialogues, enabling it to respond to user prompts or questions in a coherent and contextually relevant manner.

Users can interact with ChatGPT by providing text-based input or prompts, and the model generates responses based on its understanding of the given context. It can carry on multi-turn conversations, provide information, answer questions, and engage in interactive dialogue.

To integrate ChatGPT into PowerApps using Power Automate, you can follow these general steps:

  • Set up the ChatGPT API: Choose a ChatGPT API or service provider and obtain the necessary credentials or access keys.

 ChatGPT API reference document: -  https://platform.openai.com/docs/api-reference

 





  • Create a new flow in Power Automate: Go to the Power Automate portal (flow.microsoft.com) and create a new flow.
  • Set the trigger: Add a trigger to the flow by selecting the appropriate PowerApps trigger action. For example, you can use the "PowerApps button" trigger or the "PowerApps - When a record is created, updated, or deleted" trigger, depending on your requirements.


  • Initialize variables: Add actions to initialize variables that will store the user input and ChatGPT response. For example, create a variable called "UserInput" to store the user's message and a variable called "ChatGPT response" to store the generated response.

  • Connect to the ChatGPT API: Add an "HTTP" action to make a request to the ChatGPT API. Configure the action by specifying the API endpoint, headers, and authentication if required. Pass the user input stored in the "UserInput" variable as a parameter to the API.


  • Parse the API response: Add actions to parse the response received from the ChatGPT API. Extract the generated response from the API response object and store it in the "ChatGPT response" variable.



  • Return the response to PowerApps: Add a "Response" action to send the generated response back to PowerApps. Pass the "ChatGPT response" variable as a parameter.


  • Save and test the flow: Save the flow and test it to ensure it runs without errors. You can test it by triggering the flow from PowerApps or using the built-in test functionality in Power Automate.
  • Update PowerApps: In PowerApps, update the chat interface to display the conversation history and handle user input. Add a button or any appropriate control that triggers the flow created in Power Automate when clicked.


  • Handle the flow response in PowerApps: Once the flow is triggered and the response is received, update the chat interface in PowerApps with the generated response. For example, you can update a text box or a data source to display the conversation history.

Set(
    result,
'PowerApps-ChatGPTIntegrationFlow'.Run(TextInput1.Text).response
)



  • Test and refine: Test the integration thoroughly to ensure the chat functionality works as expected. Iterate and refine the implementation based on user feedback and identified improvements.


Thanks for reading this article. Hope this Article will help you. Cheers!!!

Wednesday, 17 March 2021

Graph APIs Calling option in "HTTP Request" connector in Power Automate

Graph APIs Calling option in "HTTP Request" connector in Power Automate. I have followed some below steps for calling Graph API:

a. Registered an App in Azure Active Directory and got Tenant ID, Client ID, Client Secret.



b. Created a Power Automate Flow and added HTTP request as an Action. In Authentication option inside HTTP action, selected Active Directory OAuth and added value for Tenant, Client ID, Secret etc.




Thanks for reading the article. Hope this Article will helpful for you. Cheers!!!

Thursday, 27 February 2020

Using of Azure Active Directory Graph API

In this article, we will discuss about How to use Azure Active Directory Graph API.

Note:- Before starting using we have to register a new app in Azure Active Directory and then need to assign Permissions, after that we are able to get Client ID, Client Secret, Object ID

Prerequisite:

i. Client ID
ii. Client Secret
iii. Object ID
iv. Azure Account User details (Username and Password)

So, let's discuss step by step:

Login to Azure AD: -


{
"name": "Login",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "client_id",
"value": "036d42bc-2b3f-41da-a302-29d09eac37eb",
"type": "text"
},
{
"key": "client_secret",
"value": "k=dZOh.RZL[0334j:A=Tx.K5bVMEx:.G",
"type": "text"
},
{
"key": "username",
"value": "sam@saddamk206.onmicrosoft.com",
"type": "text"
},
{
"key": "password",
"value": "Pak11929",
"type": "text"
},
{
"key": "grant_type",
"value": "password",
"type": "text"
},
{
"key": "resource",
"value": "https://graph.microsoft.com",
"type": "text"
},
{
"key": "scope",
"value": "openid",
"type": "text"
}
]
},
"url": {
"raw": "https://login.microsoftonline.com/78a74a06-7d8f-4205-95ca-836e6937e795/oauth2/token?",
"protocol": "https",
"host": [
"login",
"microsoftonline",
"com"
],
"path": [
"78a74a06-7d8f-4205-95ca-836e6937e795",
"oauth2",
"token"
],
"query": [
{
"key": "",
"value": null
}
]
}
},
"response": []
}



New User Registration:


{
"name": "create",
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "addTokenTo",
"value": "header",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-type",
"value": "application/json",
"type": "text"
},
{
"warning": "This is a duplicate header and will be overridden by the Authorization header generated by Postman.",
"key": "Authorization",
"value": "Bearer <Token>",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "\r\n{\r\n  \"accountEnabled\": true,\r\n  \"displayName\": \"sam khan\",\r\n  \"mailNickname\": \"sam\",\r\n  \"userPrincipalName\": \"samk1@saddamk206.on microsoft.com\",\r\n  \"passwordProfile\" : {\r\n    \"forceChangePasswordNextSignIn\": true,\r\n    \"password\": \"Pass@word1\"\r\n  }\r\n}\r\n\r\n\r\n"
},
"url": {
"raw": "https://graph.microsoft.com/v1.0/users",
"protocol": "https",
"host": [
"graph",
"microsoft",
"com"
],
"path": [
"v1.0",
"users"
]
}
},
"response": []
}


Edit User Details:


{
"name": "Edit User",
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "addTokenTo",
"value": "header",
"type": "string"
}
]
},
"method": "PATCH",
"header": [
{
"key": "Content-type",
"value": "application/json",
"type": "text"
},
{
"warning": "This is a duplicate header and will be overridden by the Authorization header generated by Postman.",
"key": "Authorization",
"value": "Bearer <Token>",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "\r\n{\r\n \"givenName\": \"sam\",\r\n    \"jobTitle\": \"Dynamics Architect\",\r\n     \"mobilePhone\": \"9988776600\",\r\n    \"officeLocation\": \"India\",\r\n    \"preferredLanguage\": \"en-us\",\r\n    \"surname\": \"Khan\"\r\n}\r\n\r\n\r\n"
},
"url": {
"raw": "https://graph.microsoft.com/v1.0/users/57e64c5f-cf09-4b85-be69-a589057d4a34",
"protocol": "https",
"host": [
"graph",
"microsoft",
"com"
],
"path": [
"v1.0",
"users",
"57e64c5f-cf09-4b85-be69-a589057d4a34"
]
}
},
"response": []
}


Update Password:

{
"name": "Update password",
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "addTokenTo",
"value": "header",
"type": "string"
}
]
},
"method": "PATCH",
"header": [
{
"key": "Content-type",
"value": "application/json",
"type": "text"
},
{
"warning": "This is a duplicate header and will be overridden by the Authorization header generated by Postman.",
"key": "Authorization",
"value": "Bearer <Token>",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": " {\r\n   \"passwordProfile\": {\r\n                \"forceChangePasswordNextSignIn\": false,\r\n                \"password\": \"mQht3Wthnj2\"\r\n            }\r\n    }"
},
"url": {
"raw": "https://graph.microsoft.com/v1.0/users/57e64c5f-cf09-4b85-be69-a589057d4a34",
"protocol": "https",
"host": [
"graph",
"microsoft",
"com"
],
"path": [
"v1.0",
"users",
"57e64c5f-cf09-4b85-be69-a589057d4a34"
]
}
},
"response": []
}


Get License:


{
"name": "Get license",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "addTokenTo",
"value": "header",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "Content-type",
"value": "application/json",
"type": "text"
},
{
"warning": "This is a duplicate header and will be overridden by the Authorization header generated by Postman.",
"key": "Authorization",
"value": "Bearer <Token>",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://graph.microsoft.com/v1.0/a4cb01c0-f5d2-4787-8cbf-9726cdd8466c/subscribedSkus",
"protocol": "https",
"host": [
"graph",
"microsoft",
"com"
],
"path": [
"v1.0",
"a4cb01c0-f5d2-4787-8cbf-9726cdd8466c",
"subscribedSkus"
]
}
},
"response": []
}


Assign License:


{
"name": "assign license",
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "addTokenTo",
"value": "header",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-type",
"value": "application/json",
"type": "text"
},
{
"warning": "This is a duplicate header and will be overridden by the Authorization header generated by Postman.",
"key": "Authorization",
"value": "Bearer <Token>",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n  \"addLicenses\": [\r\n    {\r\n      \"disabledPlans\": [ ],\r\n      \"skuId\": \"4b9405b0-7788-4568-add1-99614e613b69\"\r\n    }\r\n  ],\r\n  \"removeLicenses\": [ ]\r\n}"
},
"url": {
"raw": "https://graph.microsoft.com/v1.0/users/a4cb01c0-f5d2-4787-8cbf-9726cdd8466c/assignLicense",
"protocol": "https",
"host": [
"graph",
"microsoft",
"com"
],
"path": [
"v1.0",
"users",
"a4cb01c0-f5d2-4787-8cbf-9726cdd8466c",
"assignLicense"
]
}
},
"response": []
}


Enable-Disable User Account:


{
"name": "Enable-Disable User Account",
"request": {
"method": "PATCH",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
},
{
"key": "Authorization",
"value": "Bearer <Token>",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n    \"accountEnabled\": true\r\n}",
"options": {
"raw": {
"language": "javascript"
}
}
},
"url": {
"raw": "https://graph.microsoft.com/v1.0/users/655f60c8-66db-4c7c-a87b-76680e7f89a7",
"protocol": "https",
"host": [
"graph",
"microsoft",
"com"
],
"path": [
"v1.0",
"users",
"655f60c8-66db-4c7c-a87b-76680e7f89a7"
]
}
},
"response": []
}




Thanks for reading the article. Hope this Article will helpful for you. Cheers!!!

Wednesday, 26 February 2020

Add a Calculated Date on a Date Field with Workflow

In this article, we will discuss about How to add a Calculated Date on a Date Field with Workflow.

Here I am going to create a new workflow that will trigger on email activity record creation. And it will create a Task with Actual Start Date and Actual End Date. In Actual Start date I will put Current record creation date and in Actual End Date I will put 1-month later date.

So, let's discuss step by step:

1. Create a new workflow e.g. I have created on Email new record creation.

2. Add a step e.g. I have created a new Task in step.




3. Select a Date field e.g. I have selected a field “Actual End”.

4. I want to add 1-month later date, so I am Selecting below Values in Form Assist

   • “Month as 1”
   • “After”
   • “Email” and “Created On”
                       


                        
5. Then click on Add.




6. I am also putting Created on Value inside “Actual Start”.

7. Save and Activate the Workflow.

Now i am going to create an Email record.

After create an Email record, workflow has created a new Task and it is working fine with date values.


Thanks for reading the article. Hope this Article will helpful for you. Cheers!!!

Friday, 21 February 2020

Digital Signature Solution for Microsoft Dynamics CRM



In this article we will discuss about Digital Signature Solution Integration Created by me.

For boosting your business, close deals faster and secure using “eSignly Dynamics CRM Solution”.

Sign your business documents from eSignly inside Dynamics CRM.

eSignly for Dynamics CRM Solution enables you to sign, track and review contracts, agreements and other business documents directly from your Dynamics CRM environment within the Leads, Opportunities and all other important entities as per your choice. eSignly for Dynamics CRM Solution helps you to keep your business digital.




Key Features

 Self-Signature or Send for Signature
eSignly provide feature to for self-sign documents or send the documents for the signature of your Dynamics CRM or Integrated SharePoint’s documents. Also, eSignly provide a multiple signature hierarchy.




Instant Requested Documents Status Checker
eSignly for Dynamics CRM Solution provides a feature of checking documents status on instant basis inside Microsoft Dynamics CRM.
   
Track and Manage Document automatically
eSignly for Dynamics CRM Solution tracks status of your sign requested documents automatically and Automatically attach signed documents.

Manage Role based access for Users
eSignly for Dynamics CRM Solution provides a role base access for Documents Signature.   Admin can manage permissions for documents signing process for Microsoft Dynamics CRM Users, using Dynamics CRM Security module.



Screens:-

Configuration of entity:-


Document selection:-



Signing documents:-

       

Signed documents inside Dynamics CRM:-




Thanks for reading the article. Hope this Article will helpful for you. Cheers!!!

How to Get the Power Automate Flow Run URL Using Expressions

In many Power Automate projects, especially those involving approvals, error handling, or audit logs, it’s helpful to have a direct link to ...