note

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.

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 


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.

This sample JSON corresponds to the format in which the Rampiva Automate job-side script will send updates to Microsoft Power Apps.

7

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

This step will be used to determine if a record already exists in the Excel file for the Rampiva job in question.

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.

This step will be used to update the Excel record with the information received from Rampiva Automate.

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.

Make sure to map the fields to the the When a HTTP request is received step and not the Get a row 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.

This branch will be used to determine whether an existing record should be updated, or if a new record should be created.

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.

This step will be used to create a new Excel record with the information received from Rampiva Automate.

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.

Make sure to map the fields to the the When a HTTP request is received step and not the Get a row 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.

This setting will trigger the execution of the branch only when a record could not be matched.

35

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

This step will be used to indicate that the flow complete successfully, and is needed to suppress the error from the previous Get a row step that could not find a matching record.

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.

The right-side result panel should show Status: 202 (Accepted) to indicate that Quickbase accepted our data. This does not necessarily mean that the pipeline executed successfully.

6

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

The 28-day run history section should show a successful run event corresponding to test submission.

7

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

A dummy job record should be present in the jobs table, with the sample information submitted in this section.

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.

The right-side result panel should have Status 202 (Accepted) to indicate that Quickbase accepted our update request.

11

Return to the Excel file Rampiva Job Tracker.

The dummy job record should have updated values.

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.

For the purpose of this guide, the script is created as a local file. However, in a multi-server environment, save the script file on a file share accessible by all Engine servers, from the service account under which Rampiva Jobs are running.

2

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

The example flow created in this guide does not require authentication. If configuring the flow with Basic authentication credentials, update the username and password variables in the script from lines 9 and 10 with the corresponding credentials.

Sample settings used in this guide:

url='https://prod-175.westus.logic.azure.com:443/workflows/c924b5baadd94c6ba22cf9670491ae58/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=ZqLXqVhWEzcAJV6AfVaVSw_kF-gLm-YLN5GdSwI4W7c'
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.

A new job record corresponding to the job running in Rampiva Automate should appear.

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 https://downloads.rampiva.com/workflow-for-nuix/release/guides/en_US/user-guide.html#_script_operation 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:

debugToExecutionLog=True
debutToLogFile=True
debugLogFile="C:\\temp\\logs\\job-side-script.log"
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.

Related articles