I have created system.xml with the following configuration –
<group id="invoice_toggle_config" translate="label" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Invoice/Billing History Toggle Config</label>
<field id="invoice_search_by_options" translate="label" type="multiselect" sortOrder="31"
showInDefault="1"
showInWebsite="1"
showInStore="1">
<label>Search By Invoice Options</label>
<source_model>XYZOrderHistoryModelConfigSourceSearchByInvoiceOptions</source_model>
</field>
<field id="invoice_filter_by_options" translate="label" type="multiselect" sortOrder="31"
showInDefault="1"
showInWebsite="1"
showInStore="1">
<label>Filter By Invoice Options</label>
<source_model>XYZOrderHistoryModelConfigSourceFilterByInvoiceOptions</source_model>
</field>
</group>
And the corresponding files SearchByInvoiceOptions & FilterByInvoiceOptions consists of following toOptionArray()-
SearchByInvoiceOptions.php
public function toOptionArray(): array
{
return [
[
'label' => __('Date'),
'value' => 'filter_by_date'
],
[
'label' => __('Status'),
'value' => 'filter_by_status'
],
[
'label' => __('Invoice Total'),
'value' => 'invoice_total'
]
];
}
FilterByInvoiceOptions.php
public function toOptionArray(): array
{
return [
[
'label' => __('Invoice #'),
'value' => 'invoice_number'
],
[
'label' => __('PO #'),
'value' => 'po_number'
], [
'label' => __('Order #'),
'value' => 'order_number'
]
];
}
Now, I want the selected values via schema.graphQL i.e. when I hit the API at postman, I should get the response as the values that are selected. Here, suppose at the backend these below 3 labels are selected only. Then i should get their values like below-
"invoice": {
invoice_search_by_options: {"po_number","order_number"},
invoice_filter_by_options: {"invoice_total"},
}
Can anyone guide me at the graphql part? how that can be achieved