Selected checkbox values should be visible in sc_task description

Tuhina Sharma
Tera Contributor

Hi everyone, I have a requirement,

 

I need to display the selected checkbox variables by the user in sc_task description, I have more than 20 checkboxes, only selected checkbox variables need to display, I use set flow variable but it's now working, can you please help me on that.

 

Thanks in advance

 

TuhinaSharma_0-1712026444539.png

 

1 ACCEPTED SOLUTION

Deborah Brown L
Kilo Sage

Hi @Tuhina Sharma ,

 

You cannot get the label of a variable or a field in Flow Designer.

I can give you an alternative. Please follow the process.

Step 1: Get the variables using the "get catalog variable" action.

DeborahBrownL_0-1712038830184.png

 

Step 2: Use "Create Catalog Task" action to create the task.

DeborahBrownL_1-1712038904074.png

 

Step 3: while setting description value, use this script,

DeborahBrownL_2-1712038969401.png

 

 

var desc = '';
if(fd_data._1__get_catalog_variables.checkbox_1){
    desc += "checkbox 1 \n"; // variable name of the 1st checkbox
}
if(fd_data._1__get_catalog_variables.checkbox_2){
    desc += "checkbox 2 \n"// variable name of the 2nd checkbox
}
if(fd_data._1__get_catalog_variables.checkbox_3){
    desc += "checkbox 3 \n";  // variable name of the 3rd checkbox
}
return desc;
As we cannot get the label of the variable or field, we have to write the variable label inside condition.
 
Note: Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me.

Regards,
Deborah Brown

View solution in original post

5 REPLIES 5

Maddysunil
Kilo Sage

@Tuhina Sharma 

If you need it on server side, You can use business rule:

 

// Business Rule to update description field of sc_task with selected checkbox variables

(function executeRule(current, previous /*null when async*/) {

    // Array to store selected checkbox variables
    var selectedCheckboxes = [];

    // Check each checkbox variable and add selected ones to the array
    if (current.checkbox_variable_1 == true) {
        selectedCheckboxes.push('Checkbox Variable 1');
    }

    if (current.checkbox_variable_2 == true) {
        selectedCheckboxes.push('Checkbox Variable 2');
    }

    // Add more if statements for additional checkbox variables

    // Update the description field with selected checkbox variables
    current.description = "Selected Checkbox Variables: " + selectedCheckboxes.join(', ');

    // Update the sc_task record
    current.update();

})(current, previous);

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks

Harish KM
Kilo Patron
Kilo Patron

Hi @Tuhina Sharma in your flow designer use get catalog variables action and select item and variables

when you create a task add the check box variables here

 

or you could use onload client script on sc_task table to show check boxes which are checked

script:

var checkbox = g_form.getValue('variables.checkbox1');

if(checkbox )

{

g_form.setVisible('variables.checkbox1',true);

}

Regards
Harish

Deborah Brown L
Kilo Sage

Hi @Tuhina Sharma ,

 

You cannot get the label of a variable or a field in Flow Designer.

I can give you an alternative. Please follow the process.

Step 1: Get the variables using the "get catalog variable" action.

DeborahBrownL_0-1712038830184.png

 

Step 2: Use "Create Catalog Task" action to create the task.

DeborahBrownL_1-1712038904074.png

 

Step 3: while setting description value, use this script,

DeborahBrownL_2-1712038969401.png

 

 

var desc = '';
if(fd_data._1__get_catalog_variables.checkbox_1){
    desc += "checkbox 1 \n"; // variable name of the 1st checkbox
}
if(fd_data._1__get_catalog_variables.checkbox_2){
    desc += "checkbox 2 \n"// variable name of the 2nd checkbox
}
if(fd_data._1__get_catalog_variables.checkbox_3){
    desc += "checkbox 3 \n";  // variable name of the 3rd checkbox
}
return desc;
As we cannot get the label of the variable or field, we have to write the variable label inside condition.
 
Note: Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me.

Regards,
Deborah Brown

Hey @Deborah Brown L, thank you so much, it works.