Jump to content

Power Automate: Difference between revisions

From Resco's Wiki
No edit summary
Tag: Manual revert
 
(22 intermediate revisions by 2 users not shown)
Line 2: Line 2:
'''[https://docs.microsoft.com/en-us/power-automate/ Power Automate]''' is a Microsoft service that helps you create automated workflows between your favorite apps and services to synchronize files, get notifications, collect data, and more. Power Automate can be used to connect a [[Resco Cloud]] organization with other CRM/ERP backend systems, such as Microsoft Dynamics 365 [[Business Central]].
'''[https://docs.microsoft.com/en-us/power-automate/ Power Automate]''' is a Microsoft service that helps you create automated workflows between your favorite apps and services to synchronize files, get notifications, collect data, and more. Power Automate can be used to connect a [[Resco Cloud]] organization with other CRM/ERP backend systems, such as Microsoft Dynamics 365 [[Business Central]].


== Getting started ==
== Available connectors ==


{{YT|ze-ZjnFRhDM}}
Resco offers two connectors for Power Automate.


== Benefits ==
<imagemap>
File:List of resco connectors for power automate.png|alt=List of resco connectors available for power automate
rect 0 0 115 176 [[Resco Reports connector]]
rect 145 0 266 176 [[Resco Cloud connector]]
desc none
</imagemap>


* Connecting backends is often a complex and time-consuming endeavor. Use Microsoft-standardized integration to save time and money.
;[[Resco Cloud connector]]: Connect to [[Resco Cloud]], create, read, update, and delete records, and more.
* Automating the communication can extend Resco Cloud benefits to the users of other backends, for example, offline mobility or some field service functions.


[[File:Using Power Automate to connect Resco Cloud to other systems.png|thumb|left|600px|One of the possible usage scenarios]]
;[[Resco Reports connector]] (preview): Generate Resco's [[mobile report]]s directly from the [[Dynamics]]/Dataverse backend
<br clear=all>
== Resco Cloud connector ==


The Microsoft-certified '''Resco Cloud connector''' exposes a couple of operations that allow you to seamlessly create, read, update, and delete records.
== Sample Power Automate flows ==


[[File:Resco Cloud connector.png]]
We have prepared several sample Power Automate flows with Resco data to showcase some of the possible use cases of this technology.


=== Prerequisites ===
=== Questionnaires in Excel table ===


To use this connector, you need:
This flow is triggered when any new Questionnaire is submitted by mobile user in Dataverse. If this questionnaire is not type of template, the body of answered questionnaire (initially in the JSON format) is processed and parsed into an Excel table.
* An organization at [[Resco Cloud]] or any affiliate product from [https://www.resco.net/ Resco website].
;Used connectors: Microsoft Dataverse, Excel Online
** You can sign up for a [https://www.resco.net/request-a-trial/ free trial].
;Business value: Transfer data harvested via Inspections into XLS for further analytics.
* An user account with schema access privilege or system administrator privilege.
;Prerequisites: [[Forms+]] solution/Resco Inspections tables enabled in Dataverse
;Link: [https://docs.resco.net/mediawiki/images/5/52/ParseJSONQuestionnaire.zip Parse JSON Questionnaire]


=== Authentication ===  
=== Questionnaires in Power BI ===


This connector uses Basic authentication. When creating a new connector (in Power Apps/Logic Apps), you must provide login credentials. You must also select a server to use with this connector and the organization name you specified during sign-up.
This flow is triggered when any new Questionnaire is submitted by mobile user in Dataverse. It then refreshes the dataset of Power BI workspace. Dataset refresh is required when post-processing of JSON in Power BI because parsing JSON in DirectQuery mode is not available.
;Used connectors: Microsoft Dataverse, Power BI
;Business value: Can be used as help for further analytics of submitted questionnaires in Power BI.
;Prerequisites: [[Forms+]] solution/Resco Inspections tables enabled in Dataverse
;Link: [https://docs.resco.net/mediawiki/images/b/b8/RefreshDataSetForPowerBI.zip Refresh Data Set For Power BI]


=== Getting started ===
=== New reported issue in [[Guides]] ===


Simply add any Resco Cloud connector step to your flow and start accessing/changing data in your Resco Cloud organization. This connector allows you to perform basic data operations:
This flow is triggered when any new Guide Feedback is created by mobile user in Dataverse. If the feedback type is “Guide”, not “Step” and the step ID is not empty, it retrieves a list of system users associated with a specific guide. Then, it sends an email to each user with the comment from the feedback.  
* List records: Get a list of records.
;Used connectors: Microsoft Dataverse, Office 365 Outlook
* Get record: Get record with a specific ID.
;Business value: Can be used as monitoring/notification tool for guides.  
* Create a new record: Create a new record.
;Prerequisites: [[Steps+]] solution/Resco Guides tables enabled in Dataverse
* Delete record: Delete record with a specific ID.
;Link: [https://docs.resco.net/mediawiki/images/d/d0/GuideIssueNotification.zip Guide Issue Notification]
* Update record: Update record with a specific ID.
* Get current user: Get the current user record associated with login credentials.


=== Known issues ===
=== Generate Work Order report ===


==== Paging ====
This flow is triggered when a Work Order is selected from a list by a backend user. It takes this Work Order record and generates a new PDF report based on data from Dataverse and Resco report template. After the report is generated, it is saved as an annotation regarding the selected Work Order. 
;Used connectors: Microsoft Dataverse, Resco Reports
;Business value: Leverage advanced PDF/word reporting of Dataverse records directly in your backend.
;Prerequisites: Existing and enabled Report template for Work Order entity in Resco [[Report Designer]]
;Link: [https://docs.resco.net/mediawiki/images/d/d7/GenerateReportforWorkOrder.zip Generate Report for Work Order]


The ''List records'' action returns a maximum of 1000 records. If you would like to get more records, you have to use the ''Skip token'' input parameter. The ''Skip token'' is not returned directly, but instead ''Next Link'' is returned which contains ''Skip token'' also.
=== Daily summary ===


To resolve ''Skip token'' for the next ''List records'' action call, you can use the expression in the ''Set variable'' step like:
This flow executes every evening and check for new opportunities, work orders, and tasks created by every user. If there are any records of these kinds created that day, user gets an email with HTML tables containing a summary of newly created records with column or two of information.
;Used connectors: Microsoft Dataverse, Power Automate Operations, Office 365 Outlook
;Business value: Can be used as the end-of-the-day summary notification, either for users or management.
;Prerequisites: none
;Link: [https://docs.resco.net/mediawiki/images/5/54/DailySummary_20231005114009.zip Daily Summary]


<syntaxhighlight lang="json">
=== Sync exception ===
{
    "inputs": {
        "name": "skipToken",
        "value": "@{if(empty(outputs('List_records')?['body/@odata.nextLink']),null,decodeUriComponent(substring(outputs('List_records')?['body/@odata.nextLink'],add(indexOf(outputs('List_records')?['body/@odata.nextLink'], '$skipToken='),11))))}"
    }
}
</syntaxhighlight>


==== Triggers ====
We check for new records in the resco_mobileaudit table. If the name of newly created record is "synchronization_finish", we look for exception tags in the text and then parse the exception. Condition checks if there is anything parsed from this record. If yes, we send an email to specific user that gets notification containing the exception and the name of the user that this exception belongs to.
;Used connectors: Microsoft Dataverse, Power Automate Operations, Outlook
;Business value: Can be used as monitoring/notification tool for synchronization.
;Prerequisites: Resco Mobile CRM application with [[Auditing#Mobile_auditing|Resco mobile audit]] enabled
;Link: [https://docs.resco.net/mediawiki/images/6/63/Syncexceptionnotification_20230918111959.zip Sync Exception Notification]


For now, the connector does not support triggers. However, there is a workaround available using the server process event and invoking an HTTP request provided by "When an HTTP request is received". Simply create a new automated cloud flow, name it, and click skip to create an empty flow. Search for "Request" connector and add the "When an HTTP request is received" trigger. Set "Request Body JSON Schema" to accept the ''id'' parameter:
=== ChatGPT inspection summary ===


<syntaxhighlight lang="json">
This flow is triggered when a questionnaire record is selected from a list by a backend user. The PDF report is generated by [[Resco Reports connector]]. The completed questionnaire in the JSON format is then sent as an HTTP request to ChatGPT with the prompt to generate an overall summary of submitted data. The AI model generates a report summary, which is added to a new email activity regarding the questionnaire’s parent account. The admin, or whoever works with data in the backend, can edit the email body and questionnaire summary from the ChatGPT response. When finalized, the email with the report and summary can be sent directly from Dynamics 365.
{
;Used connectors: Microsoft Dataverse, [[Resco Reports connector]], HTTP request, Power Automate Operations
    "type": "object",
;Business value: Can be used to generate insights and summaries from complex questionnaire data automatically.
    "properties": {
;Prerequisites:   Enabled existing Report template for Questionnaire in [[Report Designer]], ChatGPT API key
        "id": {
;Link: [https://docs.resco.net/mediawiki/images/8/80/InspectionsSummary.zip Inspections Summary]
            "type": "string"
        }
    }
}
</syntaxhighlight>


Under '''Show Advanced Options''' set method to '''POST'''. Save the flow to generate "HTTP POST URL".
=== Save PDF report for multiple Accounts on SharePoint ===


[[File:Pa-flow.png|600px]]
This flow takes a list of GUIDs of selected account records as input, generates a report using the GUIDs as sources via [[Resco Reports connector]], and saves the report as a PDF file in a SharePoint folder. The file name includes the current timestamp and the original filename from the report headers.
;Used connectors: [[Resco Reports connector]], SharePoint
;Business value: Can be used to generate advanced reports/insights from numerous records on backend.  
;Prerequisites: Enabled existing Report template for Account overview in [[Report Designer]]
;Link: [https://docs.resco.net/mediawiki/images/4/4c/GenerateAccountOverviewDocument.zip Generate Account Overview Document]


Now you have to create a process to invoke trigger in your flow.
# Log into your [[Resco Cloud]] server, start the [[Admin Console]], and select '''Processes''' from the menu.
# Click '''New''', enter a name for the new process, select the desired entity (e.g., Account), and the desired event (e.g., Record is created).
# Add StringList variable '''headers''' and add item <code>Content-Type: application/json;charset=utf-8</code> to it.
# Add string variable '''body''' as "Format Text" with: <code>\{ "id": "{Entity.id}" \}</code>.
# Then, add the function step `Server.InvokeWebRequest` with `POST` method. URL copied from "When an HTTP request is received" trigger and body variable.


[[File:Resco-process.png|600px]]


Now, when you create a record of the specified entity type, the trigger activates.


=== Common errors and remedies ===


* For cloud servers, make sure that you have specified the proper server under the Connection dialog. If not, you may get an Unauthorized error.
* For custom or on-premise servers, enter the URL including protocol and port (if applicable), e.g., <code><nowiki>https://mycompany.com[:8080]</nowiki></code>.


=== FAQ ===


; How to use ''List records'' input parameters?
: These are standard OData query parameters. The syntax for each input parameter is defined by OData specification.  The only thing to think of is using logical names instead of display names. (e.g. Account -> account, Name -> name, etc.). Logical names can be found under Entities in the Admin Console.


; How do I get a picklist label?
: Each picklist field returns 2 values:
:* '''Field''' - This is the picklist value
:* '''Field (Label)''' - This is the label for the picklist value.


; How do I get a lookup label?
{{Feedback}}
: Each lookup field returns 3 values:
[[Category:Resco Cloud]] [[Category:Dynamics]]
:* '''Field''' - This is the ID (GUID) of the reference
:* '''Field (Label)''' - This is the label (primary name) of the reference.
:* '''Field (Type)''' - This is the target entity of the reference.
 
; How do I set a lookup field?
: When setting lookup fields, you have to construct a reference consisting of record type and record id.
:* From existing record in your flow, you can use '''OData Id'''
:* By creating '''logicalName:id''' expression
:* By creating '''logicalName('id')''' expression
 
<!-- == Creating a sample flow using the connector ==
 
In the following example, we are creating an instant flow that retrieves some records from Resco Cloud and saves them to Common Data Service.
 
# Select '''Create''' from the menu, then select '''Instant cloud flow'''.
# Enter a flow name and choose how the flow should be triggered.<br>[[File:Create sample flow.png|600px]]
# Click '''New step'''.<br>[[File:Manually trigger a flow.png|600px]]
# Search for 'resco' and select '''Resco Cloud''' connector.<br>[[File:Select resco cloud connector.png]]
# Select an action for the connector, for example, '''Get record'''.
# Connect to your Resco Cloud, Resco Inspections, or Resco Routes organization.<br>[[File:Connect to resco cloud.png]]
# TBD.
-->
 
<!-- == Building custom connectors ==
 
Resco has prepared OpenAPI definition files that can be used by Power Automate to create a custom connector for interfacing with Resco Cloud. Both YAML and JSON formats are available. When using an OpenAPI definition to describe a custom connector in Power Automate, [https://docs.microsoft.com/en-us/connectors/custom-connectors/faq#limits the file must be less than 1 MB]. Therefore, the API definition only includes selected entities by default. Contact [https://www.resco.net/contact-support/ Resco support] for more information.
 
{{Note|The API definition files can be also utilized by other tools and services compatible with the OpenAPI standard, not only Power Automate.|Tip}}
 
'''(Coming soon)''': You can also generate your own OpenAPI file with entities necessary for your particular use case. In the [[Admin Console]], select TBD from the menu; then select the entities (fields?) that you need.
 
-->
 
== See also ==
 
* [https://www.resco.net/news/resco-launches-integration-with-microsoft-dynamics-365-business-central/ Resco launches integration with Microsoft Dynamics 365 Business Central]
* [https://www.resco.net/blog/faq-integrating-resco-with-dynamics-business-central-power-automate/ FAQ: Integrating Resco with Dynamics 365 Business Central via Power Automate] {{Badge|Blog}}
* [https://docs.microsoft.com/en-us/connectors/rescocloud/ Resco Cloud connector documentation at docs.microsoft.com]
 
[[Category:Resco Cloud]]

Latest revision as of 10:52, 5 March 2025

Power Automate is a Microsoft service that helps you create automated workflows between your favorite apps and services to synchronize files, get notifications, collect data, and more. Power Automate can be used to connect a Resco Cloud organization with other CRM/ERP backend systems, such as Microsoft Dynamics 365 Business Central.

Available connectors

Resco offers two connectors for Power Automate.

<imagemap> File:List of resco connectors for power automate.png|alt=List of resco connectors available for power automate rect 0 0 115 176 Resco Reports connector rect 145 0 266 176 Resco Cloud connector desc none </imagemap>

Resco Cloud connector
Connect to Resco Cloud, create, read, update, and delete records, and more.
Resco Reports connector (preview)
Generate Resco's mobile reports directly from the Dynamics/Dataverse backend

Sample Power Automate flows

We have prepared several sample Power Automate flows with Resco data to showcase some of the possible use cases of this technology.

Questionnaires in Excel table

This flow is triggered when any new Questionnaire is submitted by mobile user in Dataverse. If this questionnaire is not type of template, the body of answered questionnaire (initially in the JSON format) is processed and parsed into an Excel table.

Used connectors
Microsoft Dataverse, Excel Online
Business value
Transfer data harvested via Inspections into XLS for further analytics.
Prerequisites
Forms+ solution/Resco Inspections tables enabled in Dataverse
Link
Parse JSON Questionnaire

Questionnaires in Power BI

This flow is triggered when any new Questionnaire is submitted by mobile user in Dataverse. It then refreshes the dataset of Power BI workspace. Dataset refresh is required when post-processing of JSON in Power BI because parsing JSON in DirectQuery mode is not available.

Used connectors
Microsoft Dataverse, Power BI
Business value
Can be used as help for further analytics of submitted questionnaires in Power BI.
Prerequisites
Forms+ solution/Resco Inspections tables enabled in Dataverse
Link
Refresh Data Set For Power BI

New reported issue in Guides

This flow is triggered when any new Guide Feedback is created by mobile user in Dataverse. If the feedback type is “Guide”, not “Step” and the step ID is not empty, it retrieves a list of system users associated with a specific guide. Then, it sends an email to each user with the comment from the feedback.

Used connectors
Microsoft Dataverse, Office 365 Outlook
Business value
Can be used as monitoring/notification tool for guides.
Prerequisites
Steps+ solution/Resco Guides tables enabled in Dataverse
Link
Guide Issue Notification

Generate Work Order report

This flow is triggered when a Work Order is selected from a list by a backend user. It takes this Work Order record and generates a new PDF report based on data from Dataverse and Resco report template. After the report is generated, it is saved as an annotation regarding the selected Work Order.

Used connectors
Microsoft Dataverse, Resco Reports
Business value
Leverage advanced PDF/word reporting of Dataverse records directly in your backend.
Prerequisites
Existing and enabled Report template for Work Order entity in Resco Report Designer
Link
Generate Report for Work Order

Daily summary

This flow executes every evening and check for new opportunities, work orders, and tasks created by every user. If there are any records of these kinds created that day, user gets an email with HTML tables containing a summary of newly created records with column or two of information.

Used connectors
Microsoft Dataverse, Power Automate Operations, Office 365 Outlook
Business value
Can be used as the end-of-the-day summary notification, either for users or management.
Prerequisites
none
Link
Daily Summary

Sync exception

We check for new records in the resco_mobileaudit table. If the name of newly created record is "synchronization_finish", we look for exception tags in the text and then parse the exception. Condition checks if there is anything parsed from this record. If yes, we send an email to specific user that gets notification containing the exception and the name of the user that this exception belongs to.

Used connectors
Microsoft Dataverse, Power Automate Operations, Outlook
Business value
Can be used as monitoring/notification tool for synchronization.
Prerequisites
Resco Mobile CRM application with Resco mobile audit enabled
Link
Sync Exception Notification

ChatGPT inspection summary

This flow is triggered when a questionnaire record is selected from a list by a backend user. The PDF report is generated by Resco Reports connector. The completed questionnaire in the JSON format is then sent as an HTTP request to ChatGPT with the prompt to generate an overall summary of submitted data. The AI model generates a report summary, which is added to a new email activity regarding the questionnaire’s parent account. The admin, or whoever works with data in the backend, can edit the email body and questionnaire summary from the ChatGPT response. When finalized, the email with the report and summary can be sent directly from Dynamics 365.

Used connectors
Microsoft Dataverse, Resco Reports connector, HTTP request, Power Automate Operations
Business value
Can be used to generate insights and summaries from complex questionnaire data automatically.
Prerequisites
Enabled existing Report template for Questionnaire in Report Designer, ChatGPT API key
Link
Inspections Summary

Save PDF report for multiple Accounts on SharePoint

This flow takes a list of GUIDs of selected account records as input, generates a report using the GUIDs as sources via Resco Reports connector, and saves the report as a PDF file in a SharePoint folder. The file name includes the current timestamp and the original filename from the report headers.

Used connectors
Resco Reports connector, SharePoint
Business value
Can be used to generate advanced reports/insights from numerous records on backend.
Prerequisites
Enabled existing Report template for Account overview in Report Designer
Link
Generate Account Overview Document





{{#CI form: title = Was this information helpful? How can we improve? | type = inputs | [textarea] }}