How can I get multiple lines for the task description based on checkboxes

Cupcake
Mega Guru

I have a form that has an Area (select box) and Environment (checkboxes). I want the task description based on the Area & Environment selected. The script below is halfway working, the ISSUE is if the customer selects both checkboxes the script is not adding both lines in the description.

So basically if the user selects Area = Procurement Contracts && both Environments - my expectation would be the Description box should say:

          Procurement PRODUCTION Accoun: 20789461

          Procurement NON-PRODUCTION Account#: 4032080

I am only getting the first line.

find_real_file.png

if ((current.variables.ds_area == "Procurement Contracts" && current.variables.ds_prod_env == "true") != -1){
task.description = "Procurement PRODUCTION Account#: 20789461";
} else if ((current.ds_area == "Procurement Contracts" && current.variables.ds_dev_env == "true") != -1){
task.description = "Procurement NON-PRODUCTION Account#: 4032080";
} else if ((current.variables.ds_area == "HR" && current.variables.ds_prod_env == "true")!= -1){
task.description = " ";
} else if ((current.ds_area == "HR" && current.variables.ds_dev_env == "true") != -1){
task.description = " ";
} else if ((current.variables.ds_area == "Provider" && current.variables.ds_prod_env == "true") != -1){
task.description = " ";
} else if ((current.ds_area == "Provider" && current.variables.ds_dev_env == "true") != -1){
task.description = " ";

}

1 REPLY 1

Ian Mildon
Tera Guru

I did something similar from a record producer to populate one text field with values from two other fields. I dropped this script into the Record Producer script section; but it should give you a start point for use in other areas.

 

current.to_be_encrypted = 'NPI Number: ' + producer.npi_num + '\n' + 'Care Team: ' + producer.care_team; //pass data for encryption

In my example it was gathering data from two fields so they could be combined into an encrypted field. the '\n' provided a carriage return, so the two entries were on separate lines. Replacing it with '\n\n' should provide an additional carriage return.