Trigger

On This Page

    The trigger module invokes a function or calls a remote backend when a product event, app lifecycle event, or data security policy event is fired. For example, as the result of an issue being created in Jira.

    Properties

    PropertyTypeRequiredDescription
    key

    string

    Yes

    A key for the module, which other modules can refer to. Must be unique within the manifest.

    Regex: ^[a-zA-Z0-9_-]+$

    functionstringRequired if using UI Kit 1 or triggers.A reference to the function module that defines the module.
    endpointstring

    A reference to the endpoint that specifies the remote back end that receives the event if you are using Forge remote to integrate with a remote back end.

    Required if no function is specified.

    eventsArray<string>YesA list of product events that trigger the function or endpoint.
    filterFilterNoA set of options to prevent invoking a function or endpoint.

    Filter reference

    PropertyTypeRequiredDescription
    ignoreSelfbooleanThe filter property must have either ignoreSelf or expression or both of them defined.

    Ignore self-generated events.

    For example, an app updates an issue and ignores the avi:jira:updated:issue event that is generated by this operation.

    Note that currently ignoreSelf only works with Jira events.

    expressionstring

    An expression used to filter out unwanted events.

    For example, instead of listening to all avi:jira:updated:issue events, an app can listen to events only from specific projects.

    onErrorenumNo

    Specify what should happen when an error occurs while evaluating the expression. You can either invoke a function or call a remote backend and publish app logs.

    Can be used only with the expression property.

    The possible values are:

    • (default) IGNORE_AND_LOG - don't invoke a function or call a remote backend; publish a log.
    • IGNORE - don't invoke a function or call a remote backend; don't publish a log.
    • RECEIVE_AND_LOG - invoke a function or call a remote backend; publish a log.
    • RECEIVE - invoke a function or call a remote backend; don't publish a log.

    Example

    1
    2
    modules:
      trigger:
        - key: issue-updated-trigger-with-ignore-self-and-expression
          function: main
          events:
            - avi:jira:updated:issue
          filter:
            ignoreSelf: true
            expression: event.issue.fields?.issueType.name == 'Bug'
            onError: RECEIVE_AND_LOG
      function:
        - key: main
          handler: index.run
    

    Rate this page: