system
(system)
April 15, 2021, 9:32pm
1
This topic was automatically generated from Slack. You can find the original thread here .
Tim Young : Hi all, new user here. Maybe this is obvious and just missing it but I’m using data from a webhook response to make an HTTP call. Is there a way to set a condition on some of the query paramters I’m passing in the HTTP request? For example, if {{steps.get_dealership_id.$return_value.items[0].id}} is bank, don’t pass it as a param?
system
(system)
April 15, 2021, 9:32pm
2
Dylan Sather (Pipedream) : Hi , welcome!
In your example, do you still want to pass other params if your data meets that condition, or do you want to stop the workflow completely?
system
(system)
April 15, 2021, 9:32pm
3
Tim Young : I want to pass all other params
system
(system)
April 15, 2021, 9:32pm
4
Tim Young : Sometimes the last two params are blank
system
(system)
April 15, 2021, 9:32pm
5
Tim Young : And I get this as an error and the record is not created via HTTP call
system
(system)
April 15, 2021, 9:32pm
6
Tim Young : TypeError: Cannot read property ‘id’ of undefined
system
(system)
April 15, 2021, 9:32pm
7
Dylan Sather (Pipedream) : Try changing those references to use the optional chaining operator :
{{steps.get_dealership.$return_value?.items?.[0]?.id}}
This will return undefined
instead of throwing an error if any of the intermediate properties aren’t defined.
system
(system)
April 15, 2021, 9:32pm
8
Dylan Sather (Pipedream) : (and the HTTP library we use won’t pass on any query string parameters that are undefined
, so it removes it)
system
(system)
April 15, 2021, 9:32pm
9
Tim Young : Wonderful, thank you I will try that
system
(system)
April 15, 2021, 9:32pm
10
Tim Young : Works great, thanks again!
system
(system)
April 15, 2021, 9:32pm
11
Dylan Sather (Pipedream) : Great no problem, glad to hear