# Multiple Producer Codes
## Enrollment Example
```yaml=
config:
producer_codes:
- label: 'Bob'
code: '111'
branch_code: 'xyz'
- label: 'Joe'
code: '222'
branch_code: 'abc'
```
OR
```yaml=
config:
producer_codes:
Bob:
code: '111'
branch_code: 'xyz'
Joe:
code: '222'
branch_code: 'abc'
```
## Question Group Example
```ruby=
[{
code: 'carrier_producer_codes_anchor',
group_type: :dynamic_dropdown,
text: 'Please choose your producer code:',
field_type: :anchor,
is_readonly: true
}, {
code: 'carrier_producer_codes_json',
group_parent: 'carrier_producer_codes_anchor',
text: 'producer_codes', # defines key in enrollment config
required: true,
not_copyable: true,
field_type: :json,
reference_type: :dynamic_question_data,
rules: [
AsyncSetValueActionRuleConfig.queue_job(
:FetchEnrollmentChoices,
conditions: ConditionConfig.if_question(
'carrier_producer_codes_json',
comparator: :not_exists
)
),
# => {
# 'choices': ['Bob', 'Joe'] # these are the labels
# }
#
# OR
#
# Note: This is made up below...
# It extends the `:default_value` and `:default_choice`
# with a `:default_proc`...
SetDefaultActionRuleConfig.default_proc(
:FetchEnrollmentChoices
)
]
}, {
code: 'carrier_producer_codes',
group_parent: 'carrier_producer_codes_anchor',
text: 'Producer code',
required: true,
not_copyable: true,
field_type: :text,
reference_type: :dynamic_question_answer
}]
```
Introduces:
- new `group_type` of `:dynamic_dropdown`
- new `reference_type`'s: `:dynamic_question_data` and `dynamic_question_answer`
- new question property `not_copyable` (does not allow you to copy the answer's value when application form is cloned)
- we do something similar to this already for Progressive and sensitive data
Questions:
- should we introduce synchronous set value action rules that can call out to APIs?
- if only one choice:
- should front-end automatically answer the choice into the textbox and hide everything from the user?
- should back-end async job answer the text question and hide everything?
- should front-end have a spinner for the dynamic question until it sees the `:dynamic_question_data` populated?
- what if there are no choices?
- should we just show the text box that asks for producer code?