Dynamic Data - ViewModel updates not properly
Hi,
we got some problems with a viewmodel property. We made a custom page by using dynamic data where we try to manage a part of our building access control. The page shows a derived type of configuration item but if i change the "assigned to user" property which, in our case, has its value in "pageForm.viewModel.Target_dd70b742_95fc_4423_bc8b_38136630caaf" not all properties are set correct. The name, ids and most properties are set but, for example, the department is not changed.
Is that behaviour already known or something special just in our case?
Greetings,
Daniel
Answers
Hi @Daniel_Deimling
I'm not 100% following. You have a userpicker on your form, and when you change the selected user, you are saying only the Id and Displayname change in the viewmodel?
Geoff
Hi @Geoff_Ross ,
yeah that's right. The userpicker targets that property "pageForm.viewModel.Target_dd70b742_95fc_4423_bc8b_38136630caaf" and after every change of that user we want to read the department from that user, for that we registered on the "change" event, but that property of the user is not changed.
@Daniel_Deimling
This is by design. The API to populate the User Picker only gets those two properties (DisplayName and BaseId) rather than the whole object. This if for performance. Therefore, when you select a user, it only has those two properties to change.
You code bound to that 'change' event will have to make its own API call to get the whole user object (or just the properties you need) and then use it.
Geoff