Integrate Rampiva Automate with Microsoft Power Apps (Script)

The material in this document is for informational purposes only. The products it describes are subject to change without prior notice, due to the manufacturer’s continuous development program. Rampiva makes no representations or warranties with respect to this document or with respect to the products described herein. Rampiva shall not be liable for any damages, losses, costs or expenses, direct, indirect or incidental, consequential or special, arising out of, or related to the use of this material or the products described herein.

Introduction

This article describes how to trigger the execution of a Microsoft Flow when the state of a Rampiva Automate job changes, using a script.

As an example, we will update an Excel spreadsheet shared on OneDrive to add a line when a new job runs and update the job record as each operation completes.

 

This article is part of a series:

Prerequisites 

  • Rampiva Workflow 5.4.0 or later

  • Rampiva Scheduler 5.4.0 or later

  • Microsoft Power Apps

  • OneDrive for Business


Instructions

A. Create a Microsoft Excel File to Store the Data

1

Create a new Microsoft Excel file.

2

Type in the following values in the top line:

  • Job ID

  • Name

  • Status

  • Progress

  • Volume Loaded

  • Volume Exported

  • Operation Number

  • Operation Name

  • Operation Progress

3

Select the newly added values and from the Styles section click Format as Table and select any table format.

4

Check the option My table has headers.

5

Save the file on One Drive under the name Rampiva Job Tracker.

C. Create the Power Apps Flow

1

Open Microsoft Power Apps at https://make.powerapps.com/

2

Select the Flows tab.

3

Create a New flow of the type Instant cloud flow.

4

Name the flow Update Rampiva Tracker.

5

Select the trigger When an HTTP request is received from the Request app.

This step will be triggered when Rampiva Automate makes submits an update for a running job.

6

Expand the step details and select Use sample payload to generate schema and paste the following content:

{ "id":"aaa-bbb-ccc", "name":"Sample Job Name", "status":"Running", "progress": 10.33, "volumeLoaded": 123.45, "volumeExported":50.01, "currentOperationNumber":"2/10", "currentOperationName":"Add Evidence", "currentOperationProgress": 70.01 }

The numerical values in the sample content must contain commas, otherwise the flow will identify those as integer values which will prevent the flow to run correctly with real values.

7

Add a New step with the action Get a row, from the Excel Online (Business) app.

8

In the Location field, select OneDrive for Business.

9

In the Document Library field, select OneDrive.

10

In the File field, browse to the Rampiva Tracker.xlsx file create previously.

11

In the Table field, select Table 1.

12

In the Key Column field, select Job ID.

13

In the Key Value field, add the dynamic content id from the When a HTTP request is received step.

14

Add a New step with the action Update a row, from the Excel Online (Business) app.

 

15

In the Location field, select OneDrive for Business.

16

In the Document Library field, select OneDrive.

17

In the File field, browse to the Rampiva Tracker.xlsx file create previously.

18

In the Table field, select Table 1.

19

In the Key Column field, select Job ID.

20

In the Key Value field, add the dynamic content id from the When a HTTP request is received step.

21

Leave the Job ID and Name fields blank. These fields do not need to be updated.

22

Map all of the remaining fields with their corresponding counterparts dynamic content from the When a HTTP request is received step.

23

Minimize the Update a row step by clicking on the header.

 

24

Select Add a parallel branch by clicking on the plus sign in between the Get a row and Update a row steps.

25

Click on the symbol on the Update a row step and select Configure run after.

 

26

Ensure that the option is successful is selected and click Done.

27

In the right-side branch, add a New step with the action Add a row into a table, from the Excel Online (Business) app.

 

28

In the Location field, select OneDrive for Business.

29

In the Document Library field, select OneDrive.

30

In the File field, browse to the Rampiva Tracker.xlsx file create previously.

31

In the Table field, select Table 1.

32

Map all of the fields with their corresponding counterparts dynamic content from the When a HTTP request is received step.

33

Click on the symbol on the Add a row into a table step and select Configure run after.

34

Check only the has failed option is selected and click Done.

35

In the right-side branch, add a New step with the action Terminate, from the Control app.

 

36

In the Status field, select Succeeded.

 

37

Click Save in the top-right section of the screen to save the flow.

 

38

Expand the top When a HTTP request is received step, and copy the HTTP POST URL value.

 

D. Test the Flow

1

Open the website https://reqbin.com

2

Replace the sample URL https://google.com with HTTP POST URL of the flow created in the previous step.

3

Set the method to POST.

4

In the Content tab, use the following sample data to create a new record with:

{ "id":"aaa-bbb-ccc", "name":"Sample Job Name", "status":"Backlog", "progress":0, "volumeLoaded": 0, "volumeExported":0, "currentOperationNumber":"", "currentOperationName":"", "currentOperationProgress": 0 }
5

Click Send to submit the data and run the pipeline.

6

Return to Power Apps, to the Flows tab and select the Update Rampiva Tracker application.

 

7

Open the Excel file Rampiva Job Tracker previously created in Excel Online.

 

8

Return to the website https://reqbin.com .

9

Set the contents to the following JSON data, to test updating an existing jobs record:

{ "id":"aaa-bbb-ccc", "name":"Sample Job Name", "status":"Running", "progress": 10.33, "volumeLoaded": 123.45, "volumeExported":50, "currentOperationNumber":"2/10", "currentOperationName":"Add Evidence", "currentOperationProgress": 70.00 }
10

Click Send to submit the data and run the pipeline.

11

Return to the Excel file Rampiva Job Tracker.

E. Configure the Rampiva Automate Workflow-Side Script

1

On the Engine server that will run the jobs, create the script file C:\Scripts\PowerApps-update.py.

2

Update line 8 from the script with the endpoint URL defined in the flow.

Sample settings used in this guide:

3

In Rampiva Automate, edit the Execution Profile used, and set the parameter {job_side_script_file} to C:\Scripts\PowerApps-update.py

 

 

4

Submit a Job with the updated Execution Profile.

5

Wait for the Job to start running, and then inspect the Excel spreadsheet table.

6

The Volume Loaded and Volume Exported fields are not automatically calculated. The job-side script expects this values to be available in the user-defined {volume_loaded} and {volume_exported} parameters. To update these values, add a Script operation in the Rampiva Workflow with the required logic to set these parameters. See for more information.

 

G. Troubleshooting

1

By default, the job-side script does not output logs. Update the variables debugToExecutionLog, debutToLogFile and debugLogFile as needed for troubleshooting.

Sample code to enable logging to both the Job Execution Log as well as to file in C:\Temp\logs:

2

If no log file is created when running a Job, inspect the Rampiva Engine log for python errors.

 

3

If the debug log file indicates that data is sent to Power Apps but data is not visible in Power Apps, inspect the Power Apps flow events for anomalies or errors.