
Announcements
I'm trying to build a model-driven app in which one of the multi-select choice fields in a form not only contains predefined choices, but which also allows the user to add a new value to the list if it doesn't currently exist. So, you'd have the option to select from the list or just type in a new permanent value in that list. Is this possible?
Hi @rcarroll,
Yes, it is possible to achieve this functionality in a model-driven app by utilizing custom controls or custom coding. However, out-of-the-box, Dynamics 365 model-driven apps do not directly support this feature for multi-select choice fields.
One approach to implement this functionality is to create a custom control for the multi-select choice field. Within this custom control, you could provide a dropdown list for selecting predefined values and an input field for typing in a new value. Then, through custom JavaScript or Power Automate flows, you can handle the logic to add the new value to the list of choices if it doesn't already exist.
Alternatively, you could create a workaround using a separate entity to manage the list of selectable values. This entity would include fields for the predefined choices and allow users to add new values. Then, you can use a lookup field in your main entity form to reference this separate entity, allowing users to select from existing values or create new ones.
Both of these approaches involve customization and development work, but they can provide the desired functionality of allowing users to select from predefined choices or add new values to the list.
Create a Custom Entity: Start by creating a custom entity in your Dynamics 365 environment to manage the list of selectable values. Let's call this entity "OptionSetValues" for example.
Add Fields: In the "OptionSetValues" entity, add fields to store the predefined choices and any additional information you want to associate with each value. You'll need at least one field to store the selectable values.
Configure the Form: Customize the form for the "OptionSetValues" entity to include a field for the selectable values and any other relevant fields. You can use a text field for users to input new values.
Create Relationships: If necessary, create relationships between the "OptionSetValues" entity and any other entities where you want to use the multi-select choice field.
Customize the Main Entity Form: In the form for your main entity (the entity where you want to use the multi-select choice field), add a lookup field that references the "OptionSetValues" entity. This lookup field will allow users to select existing values or create new ones.
Custom JavaScript: Write JavaScript code to handle the logic for adding new values to the "OptionSetValues" entity when the user inputs a new value in the lookup field. This code will need to trigger when the form is saved.
Handle Data Retrieval: When retrieving data for the main entity, include logic to retrieve the selected values from the "OptionSetValues" entity and display them accordingly in the multi-select choice field.
Testing and Refinement: Test the functionality thoroughly to ensure that users can select predefined choices or add new values seamlessly. Refine the customization as needed based on user feedback and testing results.
By following these steps, you can implement the desired functionality of allowing users to select predefined choices or add new values to a multi-select choice field in a model-driven app within Dynamics 365.
Check this resource out:
Multi Select OptionSet component - Power Apps | Microsoft Learn
If this post helps you, kindly give a Thumbs Up and if it solved your issue, Accept it as the solution to help the other members find it easily.
Thanks,
Robu1.