The CreatorCon Call for Content is officially open! Get started here.

Display Checkbox label when true in Description on catalog task

Brookie
Tera Contributor

My scripting knowledge is scant at best but I need help.

 

I have a Catalog Request with these checkboxes.

Brookie_0-1665121324916.png

I want the ones that are check to show in the description of the task. However when I use the data pill picker because it's only true/false it only displays true or false.

My current work around is to manually write each checkbox label out and then use the data pill picker to mark them as true or false

Brookie_1-1665121535923.png

 

As you can see it looks pretty clunky.

Is there a way to make it so that only if checkbox is true then just the label for the checkbox displays?

I have tried for 8 hours and I'm at my wit's end.

I don't know if I should be using this function in flow designer

Brookie_2-1665121630898.png

or maybe using the catalog client script

Brookie_3-1665121720670.png

If anyone could help I would be so grateful because I've invested 8 hours and I can't get anything to work.

Any help would be most welcome

 

 

1 ACCEPTED SOLUTION

Soeren Maucher
Mega Sage

If you want to go for a scripted solution, I would suggest creating a small script in the “Update Record” Action in the Flow Designer. This script will run server side in contrast to the client script on the Catalog Item (small performance and security implications).

 

4.png

 

 

var description = "";
var option_a = fd_data.trigger.request_item.variables.option_a;
var option_b = fd_data.trigger.request_item.variables.option_b;
var option_c = fd_data.trigger.request_item.variables.option_c;

if (option_a=="true"){
    description +=fd_data.trigger.request_item.variables.option_a.getLabel()+"\n";
}
if (option_b=="true"){
    description +=fd_data.trigger.request_item.variables.option_b.getLabel()+"\n";
}
if (option_c=="true"){
    description +=fd_data.trigger.request_item.variables.option_c.getLabel();
}
return description;


I hope this helped! 
Greetings, 
Sören

View solution in original post

6 REPLIES 6

Hi Mahendra and fellows, 

 

I am now able to display the checkboxes via the flow designer script above.

But, I also have reference fields using the sysid table, also multiple choice fields. Is there a way to script those into the email as well? 

 

BrianDean_0-1675828206436.png

 

How can I combine reference, multiple choice and checkbox fields together via flow designer script? This is what I have and it does not generate an email. 

 

var shortDescription = [];
var ritmVariables = fd_data.trigger.request_item.variables;
for (var variable in ritmVariables) {
var variableType = ritmvariables[variable].getQuestion().type || ritmVariables[variable].getDisplayValue() != "" || ritmVariables[variable].toString != "";

if (ritmVariables[variable] == "true") {
shortDescription.push(ritmVariables[variable].getLabel() + ritmVariables[variable].getDisplayValue());
}
}

return shortDescription.join("\n");