App Routines are restricted to the app they are created in. For example, if you create an app routine in the Contacts App, you will not be able to access it in the Activities App. However 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 article, we will go over:
The Example Scenario
In this scenario, we will use an example custom app called Contact Form. You will not find this app in your Method account unless you created one yourself.
In this Contact Form app, there is a form we want our customers to fill out. When we receive their input, we want to:
Convert their input to uppercase.
Remove blank spaces from their input.
Where to Create App Routines
On your app, click the vertical ellipsis [
⋮
] and select Manage.Select App Routines on the left menu.
To create a new app routine, select the New Routine button.
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:
Parameter | Description |
General | By clicking the edit button, you can edit the routine's name and description, and set it 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 | Define the set of actions for this app routine. |
Outputs | Specify the output and place into one or more action results. |
NOTE: The Actions section says "Edit Draft Actions" 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
Our app routine will expect one input: the text we need to convert. In this section, we will define where in the action result the text will be found: "arInput1
", as well as the expected type for the action result.
Click ⊕ Add Input.
Under Action Result, type in
arInput1
.Under Expected Type, select Text.
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.
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.
Using a Character Function action, we will convert whatever was stored in arInput1
to uppercase and then it will store the result back in the same action result. Remember the arInput1
action result was first defined in the previous section as an input.
Using a second Character Function action, we will remove spaces which are in arInput1
and store the output in the action result arOutput1
.
NOTE: The image above may look like it has blank fields, but they aren't. The Replace this field has a space in it. And the With this field has ... okay, that's blank. It has nothing in it.
When complete, the action list should have two actions in it:
Close the action list and continue on to defining the output.
Part 3 - Define the Output
Now that we have an action result in routine, we can specify the output. In the below image, we are going set the action result arOutput1
as the only output for this action routine.
Once done, we can continue to testing our app routine!