Search code examples
hasura

How to use return values of an action in the next mutation?


I'm new to Hasura and I'd like to know if it is possible to use the return values of an action in the following mutation?

How can I do something like this?:

mutation MyMutation($address: String = "") {
  mapUser(objects: {address: $address}) {
    returning {
      newAddress
    }
  }
  insert_user_one(object: {user: mapUser.newAddress}) {
    returning {
      id
    }
  }
}

Solution

  • afaik, there is no way to do this directly using graphql. What you could do is to update the action to do the insertion as well or on the client get the value from the action mutation and pass it value to the insert mutation separately.