{Step by step} Error handling in Power Automate using Try/Catch/Finally scope.

Using the Try/Catch Scope, you can create custom error messages that provide detailed information about the specific errors occurring within your flow. This can help to streamline the troubleshooting process and enable faster resolution of issues.

Requirement:

In this blog, we are generating invalid Json parameters to get the “Try” scope action failed, to demonstrate the working of the “Try/catch/Finally” scope.

Implementation:

  • Give a title to your flow.
  • Select the “Manually trigger a flow” trigger.
  • Click on “Create.”
  • Add a new action by clicking on “New step.”
  • Search for “Initialize variable.”
  • Add a name to a variable.
  • Select “String” as the type.
  • In value add an expression ‘Initial Value.’
  • Search and select the “Scope” action.
  • Add two more scope actions.
  • Rename it with “Try,” “Catch” and “Finally.”
  • Now add a “Parse JSON” action in “Try.”
  • Enter “Invalid_Json_String” in the content field.
  • And in schema add an invalid JSON.
  • Remember we are generating invalid Json parameters to get the “Try” scope action failed.
  • Add a “Set variable” action in Catch.
  • Select a variable name.
  • Enter the following expression in the value field.
  • outputs(‘Parse_JSON’)?[‘body/error/message’]
  • Select variable name.
  • Enter ‘Finally done’ in the value field.
  • Save and test the flow.
  • In this situation the “Catch” and “Finally” actions will not going to run, because of invalid parameters in the “Try” action.
  • To make it run, open the catch action menu.
  • And click on “Configure run after.”
  • Enable the “has failed” and “has timed out” options.
  • Now save and test it again.

Output:

Hope it helps! 

Power 365ing as usual! 

Any requirements, implementation or consulting work in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual? 

Problem Area – Technical, Functional, Training, Development or consulting? 

Me and my team are here to assist, please fill the following form for your business needs: Click here 

Advertisement

{Step by step} Build a Canvas Apps using Chat GPT API Key:

Requirement:

In this blog, we will learn to create a Canvas App to get a response from Chat GPT by using the chat GPT API key.

Implementation:

  • Click on “+New custom connector.”
  • And select “Create from blank.”
  • Give a title to your connector.
  • Click on “Continue.”
  • Add an icon and description.
  • In scheme select “HTTPS.”
  • Host: api.openai.com
  • Now click on “Security.”

In “Security” fill the following:

  • Click on “Edit.”
  • Select “API Key” in the authentication.
  • Parameter label: API Key.
  • Parameter name: Authorization.
  • Parameter Location: Header.
  • Now go to “Definition.”
  • Create a “new action.”
  • Provide a name to the Chat GPT API.
  • Add “Operation ID.”
  • Now click on “Import from sample.”
      {
        "model": "gpt-3.5-turbo",
        "messages": [{"role": "user", "content": ""}]
      }
  • Click on “import.”
  • In request, there is a header “Content-type.”
  • Click on the Content-type -> Edit.
  • Add a default value “application/json.”
  • Make it “Required” & “Internal.”
  • Go back.
  • Now click on “body.”
  • Make it “required.”
  • And set visibility at “Important.”
  • Do the same with “Content”, “Role”, and “Model.”
  • Now go to “Test” and create a “Test connector.”
  • Now open your custom connector.
  • Click on “Edit.”
  • Go to the “Test.”
  • Fill model “gpt-3.5-turbo.”
  • Role as “User.”
  • In “content” ask your question.
  • Click on “Test operation.”
  • You can see the Chat GPT response in the “response body.”
  • Now copy the “Response body.
  • Go back to the “Definition.”
  • In the response section, click on “default.”
  • Click on “+Import from sample.”
  • Paste the “Response body.”
  • And click on “Import.”
  • Now update your custom connector by clicking “Updateconnector.”

Let’s create a Canvas App.

  • Go to https://make.powerapps.com.
  • Sign into power apps.
  • Click on “Apps” from the left navigation panel.
  • “+New app,” Select “Canvas.”
  • Give a title to your Canvas app.
  • Select any format.
  • Click on “Create.”
  • Click on “Insert.”
  • Add a “Text input” and “Send” icon.
  • On the “OnSelect” property of the icon, write this function.
    • Set(varResponse,TestConnector.ChatGPTAPI(“gpt-3.5-turbo”,”gpt-3.5-turbo-0301″,Collect(colChats,{role:”user”,content:TextInput1.Text})));Collect(colChats,First(varResponse.choices).message);Reset(TextInput1)
  • Now add a “Flexible gallery.
  • Click on Gallery and go to the property pane of the gallery.
  • Set the layout as “Blank.”
  • Edit a gallery.
  • Add two “Text label.”
  • Turn on the “Auto height” of “label3.”
  • And write “ThisItem.content” on the “text” property of label.
  • On the text property of “Label2”, Write “ThisItem.role.”
  • Save and publish your app.

Output:

Hope it helps! 

Power 365ing as usual! 

Any requirements, implementation or consulting work in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual? 

Problem Area – Technical, Functional, Training, Development or consulting? 

Me and my team are here to assist, please fill the following form for your business needs: Click here 

{Step by step} Restore deleted Power Automate flow from the environment.

Requirement:

If you have accidentally deleted a Power Automate flow from your environment, you may be able to restore it if you have a backup or if it is still available in the Recycle Bin, if you have a backup of your environment that includes the deleted flow, you can restore the environment to an earlier state to retrieve the flow.

Implementation:      

  • Give a title to your flow.
  • Select the “Manually trigger a flow” trigger.
  • Click on “Create.”
  • Add an action by clicking on “+New step.”
  • Search and select the “Power Automate Management” connector.
  • Now select the “List Flows as Admin” action.
  • Select the environment from which you want to restore the flow.
  • Save and test your flow.
  • After testing the flow, check the output of an action.
  • You will find the list of all the flows created in your tenant.
  • Note down the “name”, which is GUID of your flow.
  • Now click on “Edit” > “+New step.”
  • Add the “Restore Deleted Flow as Admin” action from the Power Automate Management Connector.
  • Select environment.
  • In Flow, enter the Guid noted in the earlier step.
  • Save and test the flow.
  • Flow will be restored in a disabled state.

[Note: Flows can only be restored within 20 days.]

Hope it helps! 

Power 365ing as usual! 

Any requirements, implementation or consulting work in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual? 

Problem Area – Technical, Functional, Training, Development or consulting? 

Me and my team are here to assist, please fill the following form for your business needs: Click here 

{Step by step} Retrieve more than 5000 records using Power Automate Pagination.

In this blog, we will learn how to retrieve more than 5000 records using Power Automate.

Requirement:

Dataverse is a powerful platform for managing data, and Power Automate is a great tool for automating business processes that involve Dataverse. However, there are some limitations to how much data can be retrieved from Dataverse at one time, by default, Dataverse limits the number of records that can be retrieved in a single query to 5000.

Implementation:

  • Give a title to your flow.
  • Select the “Manually trigger a flow” trigger.
  • Click on “Create.”

Now add some actions.

  • Click on “New step,” and search for “Initialize variable.”
  • Select “Initialize variable” and rename it.
  • Write “Record name” in the name.
  • Select “Integer” in type.
  • And put “0” in the value.

We are adding this “Initialize variable” to get the total record count.

  • Add one more variable.
  • Click on “New step,” and search for “Initialize variable.”
  • Select “Initialize variable” and rename it.
  •  Write “Page number” in the name.
  • Select “Integer” in type.
  • And put “1” in the value.

This variable will help to send the next page number on the request.

Now create a do-until loop to run until the page Number is 0.

  • Add dynamic content of “Page number” in value.
  • Click on “Add an action.”
  • Search and select “Scope.”
  • Again, click on “Add an action.”

Scope will define your fetch criteria to retrieve the records from Dataverse.

  • Search for “List rows.”
  • Select the “List rows” action of Microsoft Dataverse.
  • Select an entity, here we have selected “Contacts.”
  • Add fetch XML query.
  • In the fetch Xml query, add dynamic content of the “Page Number” variable.
  • Add a condition.
  • Write this expression in condition.
    • “length(outputs(‘List_rows’)?[‘body/value’])”

Here, we are adding a condition to check if the list rows length is still greater than 0.

If yes, increment the length of the Page Number.

  • Click on “Add an action.”
  • Search for “Increment variable.”
  • Select “Page Number” in the name option.
  • Add “1” in value.
  • Add a “Scope” action under “Increment variable.”
  • Now add one more “Increment variable” in “scope.”
  • Select “Record Count” in the name option.
  • Write this expression in value.
    • “length(outputs(‘List_rows’)?[‘body/value’])”

If no, Set Page Number as 0.

  • Add “Set variable.”
  • Select “Page Number” in the name option.
  • Set “0” in value.
  • Add a “Compose” action.
  • Now add a dynamic content of “Record Count.”
  • Save the flow and run it.

Output:

Using Power Automate, we can retrieve more than 5000 records with Pagination, this flow runs two times, on the first run it retrieves 5000 records, and 2100 records on second run.

Hope it helps! 

Power 365ing as usual! 

Any requirements, implementation or consulting work in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual? 

Problem Area – Technical, Functional, Training, Development or consulting? 

Me and my team are here to assist, please fill the following form for your business needs: Click here 

{Step by Step}Passing parameters to Power automate from Canvas App.

In this blog, we will learn how to pass parameters to Power automate from Canvas App.

Requirement:

While working with Canva App, many times we come across a situation where we need to perform some operations through Power Automate, In this blog, we will learn how to pass the parameters to Power automate from Canvas Apps by calling a Power Automate flow, passing parameters to the flow.

Implementation:

  • Go to https://make.powerapps.com.
  • Sign into power apps.
  • Click on “Apps” from the left navigation panel.
  • Open a Canvas app, if want you can create new one.
  • In Canvas app.
  • Click on “Insert.”
  • Add “Text input‘ and “Button” to screen.
  • Click on the power automate from left panel.
  • Click on “Create new flow.”
  • Create a new flow by clicking on “Create from blank.
  • Click on the “New Step.”
  • Search for “Initialize variable.”
  • Select “Initialize variable.
  • Rename step by “Email.”
  • Select “String” in type.
  • In value field add dynamic content by clicking on “Add dynamic content.
  • Click on “Ask in PowerApps” to get an dynamic content.
  • Select “Email_Value” to get the email address which you will enter
  • Add a new step.
  • Search for “Outlook.”
  • Select “Send an email (V2).”
  • In this step add a dynamic variable content in “To.”
  • Add dynamic content by clicking on “Add dynamic content.
  • Select “varEmail.”
  • Add text value in “Subject” and “Body.”
  • Save flow and test it.
  • Now go to the Canvas app.
  • Click on the button which you have added before.
  • On the “OnSelect” property on button add this function.[‘Sendemailswithparameters’.Run(TextInput1.Text)]
  • Save and publish your app.
  • Now play your app.
  • Add Mail id and test your flow.

Output:

Hope it helps! 

Power 365ing as usual! 

Any requirements, implementation or consulting work in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual? 

Problem Area – Technical, Functional, Training, Development or consulting? 

Me and my team are here to assist, please fill the following form for your business needs: Click here 

{Step by Step} Send an email on click of Canvas App button using Power automate:

Requirements:

In this blog, we will learn how to send an email on the trigger of a button in the Canvas app by using Power Automate.

Implementation:

  • Go to https://make.powerapps.com.
  • Click on “Apps” on the left navigation panel.
  • Select “Canvas.”
  • If you do not want to create a new Canvas app, you can use the old one.
  • Give a title to your Canvas app.
  • Select any layout, here we have selected a “Tablet” layout.
  • Click on “Create.”
  • Click on “Insert.”
  • Now add a “Text label” and change the text value to “Send an email.”
  • Place this text label at the top for creating a Header.
  • Add 3 more “Text labels” and place them vertically.
  • And change their names to “To,” “Subject,” and “Body.”
  • Add 3 “Text inputs” and place them parallel to “Text labels.”
  • Rename “Text inputs” and “Text labels” from the tree view on the left pane.
  • And remove the default value from the “Text inputs.”
  • Change the display mode of “Bodyinput” (text input) “single line” to “Multiline.”
  • Click on “Insert.”
  • Select “Button.”
  • Change the button name from the tree view in the left navigation pane.
  • Change the text properties of the button to “Send” from the properties pane on the right.
  • Let’s create a Power automate.
  • Go to https://make.powerapps.com.
  • Sign into power apps.
  • Click on “Flows” in the left navigation panel > “+New flow.”
  • Select “Instant cloud flow.”
  • Give a title to your flow.
  • Select “PowerApps.”
  • Click on “create.”
  • Now, we will trigger the flow from Canvas app.
  • Click on “+ New step.”
  • Search “Send an email” in the new step.
  • Select “Send an email(V2).”
  • Here, we are using office 365 outlook for sending emails.
  • In the next step Click on “To.”
  • And add dynamic content.
  • Click on “Ask in power apps” it will automatically fill dynamic content in the “To” data card.
  • Now click on “Subject” > “See more” > “Ask in power apps.”
  • It will suggest dynamic content for the “subject.”
  • Do follow the same step for “Body.”
  • Your flow will look like this and save your flow by clicking on “Save.”
  • Let’s connect this Canvas app to power automate.
  • Click on the “power automate” on the left navigation panel in Canvas app.
  • Then click on “+Add flow.”
  • Select the flow which we have created.
  • Click on the button, and write this function on the “OnSelect” property of a button.

Sendemail.Run(ToInput.Text,SubjectInput.Text,BodyInput.Text);Reset(BodyInput);Reset(ToInput);Reset(SubjectInput)

  • Save and publish.

Hope it helps!  

Power 365ing as usual!  

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?  

Problem Area – Technical, Functional, Training, Development, or consulting?  

Me and my team are here to assist, please fill the following form for your business needs: Click here  

About the Author:

{Power 2021} Recover Deleted Environment in Power Platform

Microsoft has given the ability to create various kind of environments in Power Platform. Trial environments are often used for temporary POCs and then deleted. But what if you or your team accidentally deleted an Environment and you want to recover it.

Well, follow the following steps to recover a deleted environment (within 7 days of the deletion). In my example, I have deleted an environment called as “Test”.

· Navigate to Power Platform admin centre and click on Environments (Notice a button for Recover deleted environments):

clip_image002

· Select the environment you wish to recover and Click Recover:

clip_image004

· Confirm the pop-up that appears:

clip_image005

· Recovery will be initiated and it can take upto several hours:

clip_image006

· After recovery, you can see your required Environment back in Power Platform Admin centre:

clip_image008

Hope it helps and Power 365ing as usual!

Other ways to learn with me:

clip_image009

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

Me and my team are here to assist, Please fill the following form for your business needs: Click here

clip_image011

{Power 2021 – Wave 2} Dataverse search 101: The new way to search in Dataverse

Microsoft has recently introduced a great feature which is the new cool way to search in Dataverse – Its termed as Dataverse search.

How to enable it?

Production environments: Enabled by default

Non-Production environments: Navigate to Power platform Admin centre and you can enable the setting which is highlighted below:

clip_image002

Tip: Scroll down and don’t forget to hit the Save button on the above screen after enabling it. It will take some time first time you enable this feature(Indexes are being created in the background) – so wait for a while for awesomeness

What tables are enabled by default?

21 in total are enabled by default, here is the list:

Without D365 Apps enabled:

Account (8)
Contact (11)
Goal (19)
Goal Metric (3)
Knowledge Article (56)

With D365 Apps enabled:

Campaign (2)
Campaign Activity (4)
Campaign Response (6)
Case (5)
Competitor (1)
Contract (7)
Invoice (4)
Lead (6)
Marketing List (5)
Opportunity (11)
Opportunity Product (8)
Order (4)
Product (5)
Quote (4)
Service (1)
Service Activity (9)

How to enable the Dataverse Search for tables/columns?

Navigate to the intended solution, Click Overview and select Manage Search index:

clip_image004

You can see the tables which are already enabled, and select others as per your requirement:

clip_image006

In our example, am adding Entitlement(notice the way 11 columns are included as a resultant) and click save:

clip_image008

How to use Dataverse Search?

Navigate to your Model driven App and use Search bar on the top, in my case am searching for a Contact:

clip_image010

The resultant of the Search:

clip_image012

Notice, the filters available for Modified on and Created on Date range on the right hand side of the screen.

Let me search something more generic like “Ab”:

clip_image014

Notice, that Owner filter is also available on the right-hand side now.

Lets Locate the Contact and understand Quick Actions available (Ability to Assign, Email a link or Share the record):

clip_image016

For another entity which is activity let us see what Quick Actions are available (Mark Complete, Close, Set Regarding, Assign and Email a link ):

clip_image018

clip_image020

Let us also use Natural language searches, here we are searching for “Open Phone calls”:

clip_image022

Let us also try Boolean operators, here am Searching for D365 Champs(Account name) + 1234567890(Phone number):

clip_image024

Let us do some Wild card searching, *D365*:

clip_image026

Isn’t this going to revolutionize the way we search – off course! Great job Product Team.

What are some important known limitations and considerations?

· Certain fields are counted as multiple fields:

· Lookup: Counted as 3 fields

· Customer: Counted as 3 fields

· Owner: Counted as 3 fields

· Option Set: Counted as 2 fields

· The Find columns in Quick find Views define the fields that are searchable in Dataverse search.

· The View columns in Quick Find View define fields that will be displayed when search is conducted on Dataverse search.

· The Find conditions in Quick Find View are applied on Dataverse search results except for the following clauses:

· Like

· NotLike

· BeginsWith

· DoesNotBeginWith

· EndWith

· DoesNotEndWith

· ChildOf

· Mask

· NotMask

· MaskSelect

· EqualUserLanguage

· Under

· NotUnder

· UnderOrEqual

· Above

· AboveOrEqual

· NotNull

· Null

· Quick Actions can be configured via a new type of rule on Homepage grid commands

· Disabling Dataverse search will remove the index within a period of 12 hours.

· You can configure upto 1000 Searchable fields, out of which 50 are required by Dataverse search system – hence limit is set to 950 fields.

Hope it helps and Power 365ing as usual!

Other ways to learn with me:

clip_image027

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

Me and my team are here to help, get in touch here: Click here

clip_image028

{No Code Way} Analysing results for a PowerApps portal poll

In my last blog I have mentioned all the steps required to put up a specific poll on a page.

Please refer to the steps here:

https://dynamicsofdynamicscrm.com/2020/06/02/no-code-way-change-poll-options-for-a-specific-powerapps-portal-page/

In this blog we will see how to analyse the poll results.

Navigate to Portal management app –> Polls, the relevant Poll record and click on Options(Here you will be able to find the count of votes):

clip_image002

Click on Submissions to get list of submissions done:

clip_image004

Hope it helps and Power 365ing as usual!

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

I am here to help, get in touch here: Click here

clip_image006

{No Code Way} Change Poll options for a specific PowerApps Portal page

Polls are a great feature in PowerApps portals. However, I have seen them utilized in less scenarios.

They are a great way to increase interaction on your portals.

In one of my recent PowerApps portal projects there was a requirement to change the poll for a specific portal page. Here is the current look and feel of the portal page, notice the poll question available on multiple pages of the portal:

clip_image002

clip_image004

Now let us make the changes to fit our requirement.

Step 1: In order to do this, first we need to Navigate to Polls and click on New:

clip_image006

Step 2: Fill in the relevant Poll question as below and click save:

clip_image008

Step 3: Navigate to options and fill in relevant options one after the other:

clip_image010

Step 4: First part is now completed. Now let us see how to place this Poll specifically where we want. For this we need to create a new Poll Placement as below. Navigate to Poll placement and create new one. Here fill the right Portal name and Web Template name (this should be the one your portal page uses):

clip_image012

Step 5: Keep the Poll placement name from last step copied : ”ContactUsPoll”. Next we need to edit the web template. Liquid template knowledge helps here. However, we will just be editing a Poll name. Locate the Web Template named Contact Us and edit the tag as below:

clip_image014

Now let us see the output.

Let us first navigate to our Contact us page to see that now we have a new poll placed here:

clip_image016

Now let us go and see other portal pages:

clip_image018

Thus the poll was added to the specific page we intended.

What is the learning: Try to utilize low code way wherever possible.

Hope it helps and Power 365ing as usual!

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

I am here to help, get in touch here: Click here

clip_image020