Skip to main content

I am failing to parse how to actually reference returned values from a Functions call - while doing a test run I see that the data output is showing correctly itemized, I am unable to reference it in following steps as the “Output Return Values” always come up empty for all subsequent tasks.

I’m returning values from my test function with the autocomplete suggestion:

zapier.action.functions.return_function(
params={
"output_data":results, # Output / Return Values
},
type_of="write",
)

where results is a list of nested dictionaries:

t{'type1': 'value1_1',
'type2': {'value2_1': 5,
'value2_2': 289,
'value2_3': 5,
'value2_4': 278}
},
{'type1': 'value1_2',
'type2': {'value2_5': 47}
},
{'type1': 'value1_3',
'type2': {'value2_6': 65}
},
...

Could you please advise? Thank you in advance.

Hi ​@Balazs 

Help links for using Functions: https://help.zapier.com/hc/en-us/categories/32942726853645-Functions

Try returning data within the object {}.
See example below.

# Return the final trimmed output
zapier.action.functions.return_function(
params={
"output_data": {
"name_full": full_name,
},
},
type_of="write",
)

 

 


Hi ​@Troy Tessalone,

Thank you for the answer. As referenced in the post, that is the exact action I am using to return the values from the Function - my issue is that I can’t use the returned value in any subsequent tasks in the calling Zap as the Output Return Values is null on task runs. Please see the attached from a run history with a return value of a simple dictionary only:

 

As you can see, the return value of the function does not get populated into the Slack message as I’d expect it to behave.


@Balazs 

Did you try fixing your Function output?

Try returning data within the object {}.
See example below.

# Return the final trimmed output
zapier.action.functions.return_function(
params={
"output_data": {
"name_full": full_name,
},
},
type_of="write",
)

 


full_name = "Joe Test"
zapier.action.functions.return_function(
params={
"output_data": {
"name_full": full_name,
}, # Output / Return Values
},
type_of="write",
)

Using the above, I am still unable to reference the Function output in the Zap, despite it showing as being outputted:

 


@Troy Tessalone 

Apologies, forgot the mention for the notification.


@Balazs 

First screenshot below shows the DATA OUT for the Function step which has a data point for Name Full.

Second screenshot below shows an invalid mapped variable form the Function step in the Slack step, so you need to remap the new variable for “Name Full”.

 


@Troy Tessalone Could you guide me on how exactly do that? It is not behaving as it does with any other tasks - I’m not finding a way to reference the function output other than the previously mentioned Output Return Values:

 


@Balazs 

TIP: Click underlined field labels to see tooltips with more info.

Would you like to run this Function while testing?

Do you want to run your Function during testing?
Note: When you test from here, we will not be able to return data from the Function execution.
We will instead return the output data pre-set in the Function’s trigger.

 

So, make sure to configure your Function Trigger Sample Data to mirror the output structure from your actual Function file.

 

 

 


@Troy Tessalone 

Thank you for the answer - Sample data needs to be filled to have a properly reference-able return value from Functions.