Connecting trigger and action
    • PDF

    Connecting trigger and action

    • PDF

    Article Summary

    Available in Classic and VPC

    An example that may help with understanding connection method between trigger and action is introduced. This example creates a trigger that updates the user's location, and calls the hello action when the user's location is updated. Refer to the following guide when learning the example.

    • How to create actions
      • Using Cloud Functions > Action > Basic action
      • Using Cloud Functions > Action > Sequence action
    • How to create triggers
      • Using Cloud Functions > Trigger > Trigger
    • How to run action or trigger
      • Using Cloud Functions > Running action or trigger

    Connecting trigger and action

    The sequence for creating a trigger and action, and then connecting them is as follows.

    1. Create a basic trigger under the name SampleTrigger on the console.
      cloudfunctions-example04_01_ko
    2. Create a source code that gets a name and place and prints them.
      function main(params) {
          return {payload:  'Hello, ' + params.name + ' from ' + params.place};
      }
      
    3. Use the source code created in Step 2 and create an action on the console.
      cloudfunctions-example04_02_ko
    4. Connect it to the trigger created in Step 1 in the last step of creating the action.
      cloudfunctions-example04_03_ko
      • The trigger and action are enabled as soon as linked, so the response is immediately returned upon calling the trigger.

    Check normal operation through trigger execution

    You can check whether the trigger and action are successfully created and connected through executing the trigger. The checking sequence is as follows.

    1. Run the SampleTrigger trigger on the console.
      cloudfunctions-example04_04_ko
      • The helloAction action works with an event parameter every time a trigger is called.
      • The application priority of a trigger default parameter takes precedence over that of an action default parameter.
      • You will receive ActivationId as the execution result.
    2. Check the execution result details in the Monitoring tab menu page of the trigger and action.
      • Trigger execution result
        cloudfunctions-example04_05_ko
      • Action execution result: Check information for the activation that occurred most recently for whether the action was run, and then check if the action run by the trigger processes parameters normally.
        cloudfunctions-example04_06_ko
          {
             "payload": "Hello, Donald in Washington, D.C."
          }
        

    Was this article helpful?

    What's Next
    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.