Background
I am getting this error message three times:
Enum value used in 'when expression' should be unqualified
In relation to this code:
Schema.DisplayType fieldType = getType(fieldName);
switch on fieldType {
when Schema.DisplayType.STRING { // this line errors
// do stuff
}
when Schema.DisplayType.CURRENCY { // this line errors
// do stuff
}
when Schema.DisplayType.DOUBLE { // this line errors
// do stuff
}
when else {
throw new CustomException('Unknown field type: ' + fieldType);
}
}
Questions
- Why am I getting the error?
- How do I fix it?