If you need to access information from a previous step in script, and you don’t want to use Cyclr storage, one option is to pass the data via a field mapping.
Passing a single value #
Passing a single value to make it accessible in Script can be as simple as mapping it to an available field you’re not using.
Let’s say you want to access a Contact ID from Step A, in script in Step B. In Step B, you might have a field that’s not required for your particular integration, such as a “Description” field you could map that to:

Then in Script on Step B, you can use a before_action
event handler function to remove it from the Request (so it’s not actually included in what Cyclr sends to an external system) and perform whatever action you needed:
function before_action(){
var contact_id = method_request.description;
delete method_request.description;
// Do something with contact_id.
return true;
}
If there isn’t an appropriate field, you may be able to add a Custom Field for that, as described here: Add custom fields.
You will likely still want to delete the field from the method_request
object after you use it, as above.
Passing multiple values #
If you have more information to pass between Steps, it may make sense to add multiple custom fields. If there are a lot of fields however (an array perhaps), you have another option – passing all the values as a single, long string.
Part 1 – Stringify the values in Step A #
In the response from Step A, you’ll need to stringify the value(s) you need and add this to the response.
function after_action_paging(){
method_response.string_of_fields = JSON.stringify(method_response.array_to_shrink);
return true;
}
You will need to add a custom field to the response of Step A to hold this string. In the example above, the field location of this custom field would be string_of_fields
.
Part 2 – Parse the values in Step B script #
First, map the value to a field in Step B. As above, you may need to create a field to temporarily hold this value (in the example below, the field is named string_from_step_A
)
You’ll then need to JSON.parse the string in script:
function before_action(){
var values_from_step_A = JSON.parse(method_request.string_from_step_A);
delete method_request.string_from_step_A;
// Access values_from_step_A as if it were a JSON array again.
return true;
}