Power Automate Archives - Page 3 of 8 - - Page 3

Category Archives: Power Automate

Trigger Power Automate Flow using JavaScript – Uni-Directional

Hi All, Did you know you can use JavaScript to trigger Power Automate flows and pass input data? So, I’ll show you how to do that, as well as how to pass strict structured data and dynamic schema in Power Automate. In the next blog, I’ll talk about Trigger Power Automate Flow using JavaScript – Bi-Directional Steps to follow for Initial Setup Step 1: Let’s create a Power Automate Flow and define the input JSON schema.Go to: Power Automate Create an Instant Flow with the trigger ‘When a HTTP request is received‘ Step 2: Let’s outline the input schema and then focus on the output in a ‘Compose’ block. I’ll describe two types of inputs. (Strict and Dynamic).Our strict schema will be identified by a specific pattern indicating how the input should be given.Our dynamic schema will be recognised by an unknown pattern, and input will not always be fixed. Click on ‘Use sample payload to generate schema’. Apply the following code, click on Done and you will see the schema in ‘Request Body JSON Schema’. Add a Compose Block to check the output of the request and save the Flow. URL will be generated and is ready to be used. Let’s now proceed to create JavaScript to trigger this flow Steps to follow for calling Flow using JavaScript Since I’ll show the code snippet, adjust it as per your use case. Note: Copy your HTTP Post URL from the trigger as it will be used in the JavaScript Step 1: Type the following code Step 2: Execute the JS with ‘TriggerFlow.Main()‘. Note: Make sure you pass Execution Context to the JS Step 3: Check your Power Automate Flow History and open the Run. That’s how Power Automate is triggered using JavaScript. Hope this has helped you 🙂 Next blog – Trigger Power Automate Flow using JavaScript – Bi-Directional

Share Story :

Remove duplicate values from an array using Power Automate Flow

Hello everyone! In this blog, we will demonstrate how to schedule a flow that sends emails to all the owners of opportunities using Power Automate Flow. Scheduled flows are the best option for actions that need to be automated on a schedule and will run at a specific time or date. For instance, using this approach, you might schedule a daily data upload to Dynamics 365 or SharePoint. Use Case: Power Automate flow sends a reminder notification to the owners of Opportunities. To avoid multiple emails being sent to the same owner, we need to remove duplicate email addresses. Step 1: Log in to the required Power Apps environment using URL make.powerapps.com by providing username and password, click on Create on the left-hand side as shown below, and click on Scheduled cloud Flow. Step 2: Mention the date and time. It will appear as this. Step 3:  Initialize a variable ‘Email_addresses’ of type Array which will store all the email addresses. Step 4: Use List Rows to find the desired records from the required table. Select the table name. Also, I added the FetchXML code to fetch the required details of an entity. Step 5: Add an ‘Apply to Each’ loop and insert the previous step’s value. This is done so that the value in every iteration is stored in the Array Variable. Add a step of ‘Set variable’ to store the email addresses in the Array. Step 6:  Add a new step ‘Compose’ and declare an empty array. This helps to save time when comparing with larger sets. Step 7: Apply the Union function which removes duplicate values. union(variables(‘Email_addresses’),outputs(‘Empty_Array’)) Step 8: Apply the Join function to extract the email addresses. join(array(outputs(‘Union_function_to_remove_duplicate_mail_Values_in_Array’)),’,’) Hope this helps!

Share Story :

Power Automate Tip: Re-submit/Resend Cloud Flow automatically if there’s Server Response Failure or any condition not met

Hello everyone, You may have encountered a scenario in which Cloud Flow failed unexpectedly or failure from Server or certain conditions were not met during execution due to an asynchronous process. As a result, the Flow must be re-submitted, which is accomplished by selecting the Run History and clicking on Re-submit. In this blog, I’ll show you how to use configuration settings to automatically re-submit Failed flows. I’ll use the Parent-Child Flow concept to accomplish this. I made a simple Parent-Child Flow in which the Parent calls the Child Flow, the Child Flow sends Approval to the User, and the response is passed back to the Parent, indicating that the request was successfully completed.If the user rejects the request, it will be resent only when certain conditions for the execution are met. The steps for implementation and a guide to achieving this are outlined below. Step 1: For having Parent-Child Flows, you need to create a Solution and have 2 Flows (Parent – with any Trigger, Child – should be Manual Trigger) Step 2: Below is the Child Flow (I have used PowerApps V2 Manual Trigger) Tip: PowerApps Trigger can be seen and added later into the solution but if Manual Trigger (Blue Icon) is used then it may not show in existing Flows and cannot be used as Parent-Child is not in any solution A simple Flow, where I have sent an Approval to myself where if I have Approved it would send a response back to Parent Flow but if I reject the Approval then it will execute as Failed without passing a response to Parent Flow. Note: I have used Scope block, so if you have many Action controls and anything fails then it won’t send a response to Parent unless you have configured the flow as such. Here, the Red outlined Block, is the deciding block and the Blue block is the responding Block that will execute only if User Approves the Approval Request. Step 3: Configure the ‘Run-Only’ user for Child Flow on the main page. ‘Run-Only’ defines on who’s behalf to run the flow in the context of, since Child Flows are independent. Step 4: Below is the Parent Flow and the configuration for re-sending Child Flow in case of failure As you see, I have called the Child Flow once and displayed the output of the Child Flow. Because I’m only invoking the Child Flow once, I need to change the configuration for dealing with failed responses so that it can retry the submission of a failed response. On the Child Flow action, click the ellipse (3 dots) and then settings. For the specific action, a settings page will appear. Now we see the ‘Retry Policy,’ which determines whether the flow should retry in the event of a failure with certain conditions. In this case, I used a fixed interval; see the screenshot below. Step 5: That’s all. Now I have tested initially by rejecting the 1st request and the Retry Policy triggers and sends the 2nd request and I approve it. Thus completing the entire flow. Here’s the count of retries that occurred when you see the Run History of Parent Flow with deeper insights Hope this helped 👍🏻

Share Story :

Cancel the running flows with JavaScript code

We will look at how we can use JavaScript to cancel flows that are running without canceling each flow manually. To do this, follow the steps below. Let’s look at a scenario where we are seeing the flows that are in a running state and are not terminating. Click on All runs, this navigates you to all flow runs view. When we are in the All runs view, we need to open the developer console in the browser. The developer console can be opened by clicking F12 (or holding fn and F12) on Windows. Or by right-clicking on the screen and clicking Inspect. In the developer console, navigate to the Console pane. To clear the console window, click CTRL + L. The console pane is where we will add the JavaScript code that will cancel the running flows. As can be seen in the next step. // Copy this first and run it in the console var jq = document.createElement(‘script’); jq.src=”https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js”; document.getElementsByTagName(‘head’)[0].appendChild(jq); // … give time for script to load, then type (or see below for non wait option) jQuery.noConflict() //Paste the same again var jq = document.createElement(‘script’); jq.src=”https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js”; document.getElementsByTagName(‘head’)[0].appendChild(jq); // … give time for script to load, then type (or see below for non wait option) jQuery.noConflict() // Then copy this in the console to start the cancelation of the flows. confirm = function () {return true;}; setInterval(function () { $(“.fl-StatusInCell:contains(‘Running’)”).parent().parent().find(‘.ms-DetailsRow-cell’).last().click(); $(‘button[name=”Cancel”]’).click(); },5000); Click the running code after the code is implemented in the console, and the output will be seen below Hope this Helps!

Share Story :

Download SSRS report as a PDF with Power Automate – Part 2

In this blog, we will see how to extract the value for PdfDownloadUrl so we can load it into another request and get our PDF.

Share Story :

Download SSRS report as a PDF with Power Automate – Part 1

In this blog, we will see how to retrieve PDF Download URL from the console using the SSRS report. Step 1 – Create a new flow and set the trigger to Manually trigger a flow. Step 2 – After you have your trigger, you need to add two inputs to it, Report Name and Report XML. Step 3 – Then, add a List Rows action from the Dataverse connector and configure it to lookup the report by the Report Name.  Step 4 – Setup the report viewer – We do this using the HTTP with Azure AD connector, specifically the Invoke an HTTP request action. Step 5 – We need to authorize our connection to use this action. If you’re using Dynamics 365 online, grab your CRM URL (including https://) and paste it in for both Base Resource URL and Azure AD Resource URL. Method POST Url of the request /CRMReports/rsviewer/reportviewer.aspx Headers Content-Type: application/x-www-form-urlencoded Body of the request id=report&iscustomreport=Custom Report&reportnameonsrs=Name on SRS&CRM_Filter=encodeUriComponent(ReportXML)&reporttypecode=Report Type For encodeUriComponent – Use the following encodeUriComponent(triggerBody()[‘text_1’]) Step 6 – Extract the PdfDownloadUrl from the Report Viewer page. Let’s extract the value for PdfDownloadUrl so we can load it into another request and get our PDF. We’ll do this in 3 parts in Part 2.

Share Story :

Set multiple not resolved Email Ids as To Party CC Party & Bcc Party in D365 Email Message records using Cloud flows

Many a time it happens that we need to send emails that may be an email notification etc. to clients, with the power automate capabilities we can schedule, trigger, manually run, and do want not to automate these notification emails.  But the road blocker to all of these is not resolved email IDs, i.e. email IDs that cannot be resolved as Contacts, Accounts, Users in CRM.  We need to make changes to system settings to allow messages to these unresolved Id we have already covered this in the Blog : [https://www.cloudfronts.com/power-automate/send-email-to-not-resolved-email-ids-from-workflow-cloud-flows/]  In this blog let’s see how we can set multiple not resolved Email Ids as To Party CC Party & Bcc Party in D365 Email Message records using Cloud flows  ToParty, CCParty, BccParty are all Activity Parties and they have a ParticipationTypeMask integer value associated with them more on Activity Parties and Types in this link [https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/activityparty-entity?view=op-9-1]  ParticipationTypeMasks are as below :   Sender : 1   ToRecipient: 2  CCRecipient: 3   BccRecipient: 4  In Cloud flow create a new email record, click on “Switch to Input entire array”, populate the email in the address used field and ParticipationTypeMasks as shown below :    Hope this helps!   Thank you 

Share Story :

Get Option Set Labels in Power Automate flows

Every Option set Option has two Values associated with it :   Label Value –  which is a free text field.  Value – Which is an integer value as   In any Power Automate flow by default, we only get the integer value of an Option Set Option.  In this blog let’s see we can get a Label of an Option Set Option.  On my Accounts in CRM, I have an Option set Account Type.   I have used a Get row by ID Action to get the Account Record whose Account Type Label I need to get.  The next step is to check the Raw outputs of this Trigger Action and search for your Option Set field name.  You will see 2 values in the body of the Raw outputs as shown below.  Expression : outputs(‘Get_Account’)?[‘body/cfs_accounttype@OData.Community.Display.V1.FormattedValue‘]  Gives the Label: Business Combination.  Expression : outputs(‘Get_Account’)?[‘body/cfs_accounttype’]  Gives the Value: 224520002.  Inputs:   Output :   Hope this helps !   Thank you. 

Share Story :

Get year from Current date & Time function in Cloud Flows

We wanted to get the current year but there is no direct expression only to get the year. Below is the solution where we get the current year. Use formatDateTime function function with Utcnow(). Below is the expression we used. formatDateTime(utcNow(),’yyyy’) Output – Expression to get current date formatDateTime(utcNow(),’dd’) 2. Expression to get the current Month formatDateTime(utcNow(),’MM’) Hope this helps!

Share Story :

Creating Custom Connector for Shopify in Power Automate- Part 2

In Part 1, we created a Custom connector for Shopify and added One Action to retrieve customer data. In this blog we will add more Actions to our Shopify Connector. Actions: Create Customer Update Customer Retrieve all the products Create a new Action to create a new customer and repeat the steps as done in the previous blog(Part 1) 2. Add a request 3. Select the verb and Post request URL, to create a new customer in Shopify URL-: https://{apikey}:{password}@{hostname}/admin/api/2021-10/customers.json Example URL (For reference)- https://9ed959ec1ed8536c82689353bf247c78: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@sans-the-label-designer.myshopify.com/admin/api/2021-10/customers.json 4. In the Request area, choose body then Edit. 5. In the Parameter area, you now see all the parameters that the API expects to create a new customer. We will make the first name, last name, and email as required. Select ‘first_name’ click on more commands(…) and then click on edit. 6. Add a response Go to Response section and click on “Add default Response” NOTE-  you can add sample response from the Shopify API Documentation Customer (shopify.dev) 7. Paste the sample in “Body” and click on Import 8. Once all the actions are done, click on Update connector 9. Perform the below actions similarly like the above action- Update Customer: Create a new Action Enter Summary, Description, and Operation ID Summary: Update Customer Description: Update Customer in Shopify Operation Id: UpdateCustomer Go to Request and Click on “Import from sample” Select the verb and PUT the request URL to update customer in Shopify URL- https://{apikey}:{password}@{hostname}/admin/api/2021-10/customers.json Example URL(For reference)- https://9ed959ec1ed8536c82689353bf247c78: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@sans-the-label-designer.myshopify.com/admin/api/2021-10/customers/{customer_id}.json Add a response. Retrieve all Products Create new Action Enter Summary, Description, and Operation ID Summary: Retrieve All Products Description: Retrieve All Products Operation Id: RetrieveAllProducts Go to Request and Click on “Import from a sample” Select the verb and GET request URL to retrieve all the products. URL-https://{apikey}:{password}@{hostname}/admin/api/2021-10/customers.json Example URL (For reference)- https://9ed959ec1ed8536c82689353bf247c78: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@sans-the-label-designer.myshopify.com/admin/api/2021-10/products.json Add a response. 10. Using Custom Shopify connector in MS Flow. Go to Custom and select Shopify connector You can see all the actions Output-

Share Story :

SEARCH BLOGS:

FOLLOW CLOUDFRONTS BLOG :


Secured By miniOrange