What is an Action?

What is an Action and how to use it when customizing Method

Updated over a week ago

When an event has triggered, one or more actions will launch. Actions are executed, one after another in sequential order, because of an event.

Let’s illustrate this in an example. Below is a blank screen with one section in it. It currently does nothing. 

So let’s give it a button. I will drag one from the Insert Controls panel into the empty section. Perfect. It will look like the image below.

Now actions cannot happen unless an Event is triggered. Before we can add actions to the button, we need to choose the event the actions will go into. 

To find the events for the button, click the down arrow ▼ on the button itself to open up a menu.

Note theicon which looks like a thunderbolt? That's an event. Unsurprisingly, there is only one event for a buttons, and that is the Click event

NOTE: Thethunderbolt icon indicates an Event.

Hopefully, understanding this event is straightforward: the Click event occurs when a user on your screen clicks the button. 

Now we need to add actions to when someone clicks the button. In order to do this, we will edit the Click event by clicking on the "Click" option.

When you select this, the Action Editor pop up. This is where you can now add as many actions as you wish to this Click event. 

The Action Editor is split into two parts:

  • Action Set: On the left is a list of actions in this event.

  • Action Properties: On the right is a panel that will allow you to configure an action that is selected.

From here, you have a number of actions to choose from, which you can see in our List of Actions

For our purposes, let’s make this button do something simple, like display a "Hello" message. See the search bar? I'll search for the action Show Message and then select it!

When you select Show Message, that action will show up on the left list. That means this action will run when the button is clicked! In the right panel, you can configure the Show Message action. 

Each configuration section is unique to the Action it applies to (again, you can learn more from List of Actions), but above is what the Show Message action looks like. 

I'll fill it in with:

  • Title: "Hello Message"

  • Message: "Thank you for clicking the button"

The Internal Note is worth including, because it allows you to keep track of what your action is designed to do. This might not sound like a big deal, but believe us — when you get to building controls with maybe tens of actions associated with them, it’s helpful to know what each was meant to do. Also, if anybody else is working on your app, they’ll have a road map to what you were intending to do as well!

Actions are automatically saved, so once complete, I'll close the action editor with the Close button at the top. I will then close the design mode of the screen and give my button a try! It will display our message:

Our button works! So what happened?

  • User clicks the button.

  • This fires off the button's Click Event.

  • This event launches the actions configured inside of it.

  • The only action inside of it is the Show Message action. 

  • The Show Message action shows the Hello Message.

It’s that simple.

Creating more complicated action series for controls is really just building on these basic principles, which we will explore in the Mission section. And, for a full list of actions available in Method, check out the List of Actions.


Action Parameters (Input)

Actions normally take parameters: data used as input for the action to work with.

Many actions require specific parameters for the action. For example, for the action to generate a report, the action will require the Report Name. For an action to check permissions, the action will require the user who's permissions you want to check.

However, a number of action parameters will ask for a more generic value. For example, the Update Controls on Screen needs text data to update the control with. Not only can you type in the text, but this text can come from a variety of sources. There can be up to four sources to choose from:

The source for the parameters are usually:


Example

For the Show Message action as shown below, there are four parameters:

  • Title

  • Message

  • Insert a value into the message

  • Show these button(s)

For the Title and Message parameters, these parameters are defined by you. You will type in the title and the message.

Many parameters allow you to type in a user-defined value, but there are many cases where the values you need are already on the screen, or are calculated elsewhere.

For example, the Insert a value into a message dropdown allows you to insert a value from:

  • an Action Result

  • an existing Control on the screen

  • a value from the Session

However, when assigning a value, the majority of actions usually allow for all four.


Storing Results of Actions (Output)

Once an action is complete, most actions will result in a value which can be stored in a variety of different places.

For example, in the below Character Functions action, once you join two pieces of text together, where will the result go?

At the bottom of the action is a section to store the result in. Normally, there are two places you can store the result of an action:

  • In an action result or a shared result

  • An existing control on the screen

The purpose of storing the result is to access it later, whether it be visually by the Method User, or from another action itself.

When creating a brand new action result, a dropdown appears with "(New)" appended to the name you are giving it, as shown in the below image. You must click that dropdown option to create the action result else it will be empty and you will get an error.

If you wish to store the result in an action result previously created earlier in the action list, type in the first few letters and a list of action results already created will show up in a dropdown:

Select the action result you wish to store it in.

Did this answer your question?