In reply to: Daniel Krüger (Cosmo Consult)
Hi Nik,
can you switch the mode of the field from dropdown to autocomplete or popup search? Then you could set the value of the field to the workflow id and it will work just fine. I blogged about the same approach here:
https://daniels-notes.de/posts/2022/add-new-choice-field-value-without-leaving-the-page
I have only two other ideas, but I don't know if one will work:
1) When you switch to a different tab, all elements in the current tab are "destroyed" and the new ones are added. It could be that this also applies if a group is collapsed/expanded. Maybe that values of the drop down are retrieved each time, the field is added. Of course it could also be, that the values are retrieved only ones.
2) Did you test, whether you can add the new value as a select option via JavaScript, so that you can set the field to the new value? I doubt that the server will be interested in our changes. If there's any kind on validation on the server, it will use the actual data and not some UI data. This is at least my assumption.
Best regards,
Daniel
Hi Nik,
it seems that idea 2 would have worked, but won't do so in the future:
From the change log of 2021.1.5, and this will probably be included in the next 2022 version too.
Added a mechanism for checking the integrity of data set in the choice fields with data source
values configured for this form field. Attempting to unauthorized setting a value not present in
the source (e.g. using JS API) will fail and generate an exception.
In previous versions, the system allowed to set values in the ID#Name format using JS API,
even if such a value did not exist in the data source. After the update to the latest version, any
attempt to set a value in the choice field (in any format - ID, Name, or ID#Name) will validate
this value with the data source values. The value not found in the data source will not be set in
the choice field.
Best regards,
Daniel