Drag and drop variables to script

Juanm0765961779
Tera Contributor

Hello All,

I'm hoping someone out there can assist me with this task.  The field in question is "Description" and what I currently have is in the image below.

 

What I'm looking to do is script this part within the Catalog Task itself because there may be occasions where a user may leave 'Server Name' or 'User Account' empty.  Rather than those values just being blank, I'd like to add the phrase "User did not provide the information".

 

Is that possible?

 

Screenshot 2024-09-17 010627.png

3 REPLIES 3

Swamy Malluri
Tera Guru
Tera Guru

Hi @Juanm0765961779 ,

 

In flow designer create task activity you select toggle script option for field where you want to set the text. 

In script you can access variable values using syntax "fd_data.trigger.request_item.variables.variable_name;" and validate value, set the description as you which . Below is the sample code

if(fd_data.trigger.request_item.variables.server_name == "" ||  fd_data.trigger.request_item.variables.User_Account == ""){

var result = "User did not provide the information";

}

return result;

 

Please accept my solution or hit help button if answer address your query.

 

Thanks,

Swamy

Juanm0765961779
Tera Contributor

Does it make a difference if I'm pulling from "1 - Get Catalog Variables" vs "Trigger" or "RITM"?

 

image.png

OlaN
Giga Sage
Giga Sage

Hi,

Yes it's possible.

I would recommend to store the values retrieved from the Catalog variables in a Flow variable.

Then you can evaluate in the Flow, if the Flow variable is empty, set the value to something as you wrote, and finally use the Flow variable data as input in the description instead of the Catalog variable.