diff --git a/frontend/src/common/js/custom_field.js b/frontend/src/common/js/custom_field.js index 8f262f71eb..abe03a4d19 100644 --- a/frontend/src/common/js/custom_field.js +++ b/frontend/src/common/js/custom_field.js @@ -58,6 +58,11 @@ export function parseCustomField(data, template, customFieldForm, rules, oldFiel for (let i = 0; i < data.customFields.length; i++) { let customField = data.customFields[i]; if (customField.name === item.name) { + if (customField.type === 'multipleSelect') { + if (typeof (customField.value) === 'string' || customField.value instanceof String) { + customField.value = JSON.parse(customField.value); + } + } setDefaultValue(item, customField.value); break; } diff --git a/frontend/src/common/js/tableUtils.js b/frontend/src/common/js/tableUtils.js index dcfff9b76c..38a1603dbc 100644 --- a/frontend/src/common/js/tableUtils.js +++ b/frontend/src/common/js/tableUtils.js @@ -469,7 +469,12 @@ export function getCustomFieldValue(row, field, members) { else if (['multipleSelect', 'checkbox'].indexOf(field.type) > -1) { if (item.value) { let values = ''; - if (item.value instanceof Array) { + try { + if (field.type === 'multipleSelect') { + if (typeof (item.value) === 'string' || item.value instanceof String) { + item.value = JSON.parse(item.value); + } + } item.value.forEach(v => { for (let j = 0; j < field.options.length; j++) { let option = field.options[j]; @@ -480,6 +485,8 @@ export function getCustomFieldValue(row, field, members) { } } }); + } catch (e) { + values = ''; } return values; }