cancel
Showing results for 
Search instead for 
Did you mean: 

Workato If formula

habeebkhan
Deputy Chef I
Deputy Chef I

Hi everyone. 

I had a query with regards to a formula. I have a scenario where on a Wrike form, I have 4 fields that I get as a user input. Below are the fields:

1. Goal
2. Campaign Purpose
3. Target Audience 
4. Value Proposition
 
I would like to concatenate all of these if the user input exists for it into a 'Description' field on the Campaign Object in SFDC. So basically if 'Goal' is present it displays as below:

Goal: and then its corresponding user input from the wrike form.

If 'Goal' is empty, then it skips it. Similarly for 'Campaign Purpose', 'Target Audience' and 'Value Proposition' all concatenated under the same 'Description' field. 


Do you have an idea how I can write a formula for this? I tried using Chatgpt as well but it didn't give me the correct formula. I am currently using IF else in the Steps, but this consumes 10 extra tasks. I would like to write a If else formula instead in the 'Description' field. 
2 REPLIES 2

gary1
Star Chef I
Star Chef I

Your request is a little unclear but I get the idea.

This part is unclear:

If 'Goal' is empty, then it skips it. Similarly for 'Campaign Purpose', 'Target Audience' and 'Value Proposition' all concatenated under the same 'Description' field. 

Do you mean "If Goal is empty, skip the entire concatenation step and do nothing"? Or do you mean, "The formula only concatenates the values that are present"?

You can concatenate the values like this. The smart_join method will skip null/blank values. You can use any delimiter characters you want in smart_join.

 

[ Goal, Campaign, Target, Value].smart_join(" - ")

 

If you want to do this conditionally based on the presence of Goal and Campaign, you can use the below. 

Goal.present? && Campaign.present? ? [ Goal, Campaign, Target, Value].smart_join(" - ") : ""

The above formula is called a ternary operator which a really fancy way of saying "minimalist if statement" which is also a really fancy way of saying "if". It's used constantly in Workato. The basic format is:

[boolean] ? [result if true] : [result if false]

 Hope this helps!

Bhagya_pola
Deputy Chef III
Deputy Chef III

Hi @habeebkhan 

Here’s how I usually handle this scenario — using ternary operator ,  .present?, skip, and smart_join("\n") to build the description dynamically based on available input. This avoids using multiple IF steps and keeps everything within a single formula.

It checks each field, adds it only if present, and neatly joins them with line breaks. Efficient and clean!


Screenshot 2025-07-13 162442.png

My Output:
Screenshot 2025-07-13 162400.png

 










My input for the above output:

Screenshot 2025-07-13 162428.png