How to create conditional logic based on a field or value