SELECTED ANSWER
replied on April 10, 2024
Hey @████████- if you want to populate multiple checkboxes, you'll need to create an array of the values to set to the checkbox. Setting one at a time like that will reset the checkboxes to just the single item each time.
Here's your code rewritten to call a function from any of the three completed lookups. The function creates an empty array and then adds to the array for each of the field values it is checking. Once the array has been fully built, it pushes the array to the checkbox field as the full list of values.
LFForm.onLookupDone(PopulateCheckboxes, {lookupRuleId: 23});
LFForm.onLookupDone(PopulateCheckboxes, {lookupRuleId: 29});
LFForm.onLookupDone(PopulateCheckboxes, {lookupRuleId: 25});
function PopulateCheckboxes() {
var checkBoxArray = [];
if (LFForm.getFieldValues({variableName: "Consultation"}) == "True") {
checkBoxArray.push("Consultation");
}
if (LFForm.getFieldValues({variableName: "One_to_One"}) == "True") {
checkBoxArray.push("One_to_One_Intervention");
}
if (LFForm.getFieldValues({variableName: "Push_In"}) == "True") {
checkBoxArray.push("Push_In");
}
LFForm.setFieldValues({fieldId: 7}, {value: checkBoxArray});
}