App Routines are defined per app. In other words, an app routine is only visible within the app it is defined. Although other apps will not be able to use it, any screen inside the app is able to use the app routine. 

To create an app routine, you need to manage the app. In this scenario, we will use an example custom app called Contact Form (you wll not find this app in your Method account unless you created one yourself). 

Furthermore, let's assume there is a form we want our customers to fill out. When we receive their input, we want to convert it to uppercase, as well as remove any blank spaces. 

Where to Create App Routines

1. Click the vertical ellipsis ( ⋮ ) and select manage in the app you wish to define the app routine.

2. Select App Routines on the left menu. 

3. To create a new app routine, select the New Routine button.

4. Give the app routine a name and description.

Once saved, you will be presented with a page to define the App Routine.

How to Define an App Routine

In the below example, the app routine was given the name "Format Input" and was given the description as shown in the image below.

There are four sections you need to be aware of when defining an app routine:

  • General: By clicking the edit button, you can edit the routine's name and description, as well set the routine as active or inactive.
  • Inputs: An app routine can have multiple inputs stored in separate action results. These action results will be available when defining actions in the next section. In this section you define the action results and the type of data you expect to be inputted.
  • Actions: This is where you create the set of actions which are part of this app routine.
  • Outputs: An app routine can return multiple action results

Note that the Actions section says "Edit Draft Actions". This is because App Routines are not available to be used until they are published. Until then, they are in a draft state.

Continuing with our scenario, let's define this app routine. 

Part 1 - Define Input and Outputs

Our app routine will expect one input: the text we need to convert. It will also return one ouput: the text after the conversion. We will create one action result for the input (arInput1), and another action result for the output (arOutput1). 

Part 2 - Define the Actions

When you click Edit Draft Actions, you will be taken to the action editor which is exactly the same as editing actions on an app screen, except this time, the header is coloured blue.

Note that you can also copy actions from any control within the same app. This allows you to migrate older action sets to be re-used as an app routine.

Explaining how actions work is beyond the scope of this article, so here's a quick overview on the actions being put into this app routine

The first action will convert whatever was stored in arInput1 to uppercase and then it will store the result back in the same action result. Note that the arInput1 action result was first defined in the app routine as an input.

The second action will remove spaces which are in arInput1. The results are stored in the output action result arOutput1.

With this, our example app routine is done! You can save this action set, and then save the app routine as well.

Did this answer your question?