Modify list values
Deletes certain list values from all combo boxes that contain a specific key.
(function removeListValues() {
let key = "YourKey"; // Change this to your specific key
let valuesToRemove = ["Option1", "Option2"]; // List of values to remove
let doc = Api.GetDocument();
let formFields = doc.GetAllForms();
for (let i = 0; i < formFields.length; i++) {
let formField = formFields[i];
if (formField.GetFormType() === "comboBoxForm" && formField.GetFormKey() === key) {
let options = formField.GetListValues();
let newOptions = options.filter(function (option) {
return valuesToRemove.indexOf(option) === -1;
});
formField.SetListValues(newOptions);
}
}
})();
Methods used: GetDocument, GetAllForms, GetFormType, GetFormKey, GetListValues, SetListValues
Result