Skip to main content
(Re)assign text variable step

Assign a new or different value to a text variable.

Updated over a year ago

After reading this article you'll know:

  • What (re)assigning text variables is

  • Why you'd use the (re)assign text variable step

  • How to use the (re)assign text variable step in your application

Getting started

The (re)assign text variable step can be found in the block store and is used to assign a new or different value to a text variable. To find the step go to the block store and search for 'assign', the (re)assign text variable step should pop up.

(Re)assign text variable step in the blocks store

Click on View details followed by Install block to install the block to the appropriate organization and application.

Installing (re)assign text variable step

Once installed we can use the step in our application.

Starting off

We can create a new action, I'll keep the use case as simplistic as I can keep it since this step doesn't need an in-depth use case.

So to get rolling, I'll create an action called 'Turn any fruit into an apple'. The name will make more sense later, next, create a text variable named 'fruit' and give it a value such as 'pineapple'. With this in place, drag the (re)assign text variable step in the action flow. The step is rather self-explanatory, fill in what value the new text variable needs to have, then select which variable needs to change.

Setting up options for (re)assign text variable step

This will now change the fruit variable with the value pineapple to the value apple. To demo this a bit better we can use the log step to show how value changes. Check out this article to learn how the log step works.

Install the step above, afterwards, we can use it; drag one log step above the (re)assign text variable step and one log step after the step. We can then configure the first log step like this:

Adding a log message step to the action flow

And the second one like this:

Adding a log message step to the action flow

If we'd now test the action in the playground by clicking the Test run button in the top right corner. Copy the mutation code and open the playground.

Testing action flow with (re)assign text variable step

Paste the mutation and hit the Play button in the playground.

Testing action flow with (re)assign text variable step

If you don't see the same as the image above make sure to add the fruit variable in the finish step. Regardless, once we ran this we can check our logs to see what happened to the initial fruit variable with the value 'pineapple'. Go to the Tools section and click the Logs overview.

Testing action flow with (re)assign text variable step

We'll get an overview of all the logs of the application and if the action ran successfully we should see the two log steps appear here:

Testing action flow with (re)assign text variable step

And there we go! The action works exactly as we expect it to, this is a very plain example but it should give you an idea of how to use this step for specific use cases where you need to change the value of a variable within the flow of your action.

Did this answer your question?