Prefill DropDown menu

0
For the creation of a new request i show users a new request form. This form contains a reference selector field, this field contains only the name of the current person / loggend in user. This has been done using an xpath. But the user still needs to select an option, but there is only one, their own name. I searched the mendix community and helpfiles, but only reference set selectors have the option to prefill a default value. Is there a way to prefill this value to the only selectable value?  
asked
2 answers
2

You could use an “After Create” event handler for your request entity in the domain model. In your new “ACR_Request” microflow, you could retrieve the respective person and connect it to your request by setting the association accordingly.

Here’s a guide to event handlers: https://docs.mendix.com/refguide/event-handlers 

answered
1

You could fill this value on creation of the record that is on the page. In the MF that opens this page, do a retrieve and a count to see if only one value is there. If there is 1 value, change the newly created object to that value, else, leave it empty.

Or just retrieve the $currentUser and add that to the newly created object, if that is the case.

answered