Hi community,
I used a webhook trigger and mapped it into a variable.
Sometimes the event_payload_json.note is an empty string ("").
When this note is an empty string, I want to use the default value that I already set for that variable. Is it possible to do that? If so, how?
At first, I tried to create an edge condition and another data mapping task (Data Mapping I), but since this task connected to multiple branches, the integration flow failed because the edge condition wasn't fulfilled.
Solved! Go to Solution.
Hey @nickodemusrr you can run separate data mapping task for the two conditions - "when empty string" and when "non empty string". Or you can conditionally do a data mapping when empty string and then run a common task.
See Edge and Edge conditions Documentation
I see that you have already attempted this solution - ensure you use double quotes for the string comparison
Alternatively, you could use Javascript and write a simple "if-else" condition. If you are unfamiliar with Javascript the Script with Gemini feature can help you write the code using Gemini.
I would also recommend going through the logs to figure out why the edge condition is not being met.
Hi @nickodemusrr,
You can use the following approaches, depending on the specific tool/platform you're using:
Option 1: Use a Conditional Expression in a Data Mapping task
To handle empty event_payload_json.note values in your data mapping task, you can use conditional logic functions commonly available in modern mapping tools, such as IF, COALESCE, or NULLIF.
A simple approach is to use an expression like coalesce(event_payload_json.note, 'default value'), which returns the note if it's present or a default value if it's empty. Alternatively, create a data mapping task (e.g., "Handle Note Default") that checks if event_payload_json.note is an empty string; if so, it sets a default value, otherwise it passes through the original note. Place this mapping step after your webhook trigger and before any components that depend on the note.
Option 2: Use the presence Method (Ruby/Workato Specific)
If you're using Workato, a more concise and idiomatic way to handle empty values is by using the .presence method in the formula editor.
This method returns nil if the string is empty or blank, allowing you to easily fall back to a default value or another variable using standard Ruby-style logic within the IF function.
It's also a good idea to reach out to Google Cloud Support for further guidance and assistance in reviewing your project setup.
Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.
@nmagcalengjr thank you for your suggestion, that could be helpful in another use case.
I guess this forum was about GCP Application Integration. As per the documentation, I didn't see any coalesce (or something similar) function in the data mapping task. Since the requirement is to use GCP Application Integration, it becomes challenging. Therefore, if possible, I need help with a workaround for the case in the GCP Application Integration. I know sometimes there are limitation in using this product.
Hey @nickodemusrr you can run separate data mapping task for the two conditions - "when empty string" and when "non empty string". Or you can conditionally do a data mapping when empty string and then run a common task.
See Edge and Edge conditions Documentation
I see that you have already attempted this solution - ensure you use double quotes for the string comparison
Alternatively, you could use Javascript and write a simple "if-else" condition. If you are unfamiliar with Javascript the Script with Gemini feature can help you write the code using Gemini.
I would also recommend going through the logs to figure out why the edge condition is not being met.