How to assign value to parameter defined in workflow

Hi

I have defined a parameter like now in .config.yml

  context_id:
    type: string
    default: ""

now in one of the job i am trying to assign to some jq json filtered value to this parameter so that i can use this variable later

      - run:
          name: check
          command: |                   
            jq -r 'values.id' /tmp/output.json >> ${context_id} \
            echo ${context_id} \

Error:

#!/bin/bash -eo pipefail
jq -r 'values.id' /tmp/output.json >> ${context_id} \
echo ${context_id} \     
cat /tmp/output.json

/bin/bash: ${context_id}: ambiguous redirect

Exited with code exit status 1
CircleCI received exit code 1

Please help

Parameters are accessed via the format of << context_id >> and environment variables ${context_id}

Examples can be found here

  https://circleci.com/docs/2.0/pipeline-variables/

Hi @onenessboy ,

As @rit1010 mentioned, parameters’ values are accessed using the syntax << parameters.parameter_name >>. However, it is not possible to assign a value directly to a parameter.

What you need to use, in this case, is the env_var_name parameter type. You can then assign a value to the corresponding environment variable, and it’ll be passed on to the env_var_name parameter that refers to it.

The parameter value will then have to be accessed using the following syntax:
${<< parameters.parameter_name >>}