# GraphQL - Custom action

This action can be used to run any custom GraphQL operation.

This is useful if you have existing GraphQL queries or mutations that you want to reuse in your recipes.

It also allows you to use advanced features of GraphQL query language, such as:

  • Variables
  • Fragments
  • Inline-fragments
  • Directives
  • Aliases
  • Multi-operation documents

See the GraphQL documentation (opens new window) for more information about these features.

# Input fields

At a minimum, the GraphQL document must be provided. It must be a valid GraphQL query or mutation.

In the following example, the GraphQL document is a simple query for the details of a record with a specific ID, which is hard-coded in the query:

Simple custom query Simple custom query

Instead of hard-coding the ID, you can use recipe datapills to inject the ID.

The record ID is set by the Role Id datapill from the output of Step 2:

Custom query with datapills Custom query with datapills

Alternatively, you can also define a variable in your GraphQL document and let the user provide the value through an input field.

For example, you would enter the Role ID to provide the value for the $role_id variable:

Custom query with variables Custom query with variables

If the GraphQL document contains multiple queries, you must select the operation to run.

The following document contains the queries RoleWithTags and RoleWithoutTags, and the Operation to perform is set to Role without tags:

Custom query with multiple queries Custom query with multiple queries)

# Output fields

The output fields are determined by the fields mentioned in the query. To use them in downstream steps, map in the relevant datapill from the datatree.

Example output fields for the GraphQL custom action Example output fields for the GraphQL custom action


Last updated: 6/12/2023, 8:52:04 PM