-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix - Wrong preselected user in dynamic form #1316
Fix - Wrong preselected user in dynamic form #1316
Conversation
…longer in the peoplePicker default value
…turn the default value for the peoplepicker with the UPN and not the ID
@joelfmrodrigues maybe someone can look into this? we have a problem with that at a project from us, and this would really help a lot! :) thanks in advance! |
@SmarterJB sorry that it took so long to find the time to review this. I then switched back to the dev branch to double-check if this was a gap in your version compared to the current behaviour, and actually got the exact same result. The user is pre-loaded, but not the group. Can you confirm if these were also the results that you experienced? This was the part of your comment that made me double-check things: |
Damn @joelfmrodrigues you are right, groups are not loaded correctly, because my select on fieldname/Name for users returns their UPN, but for Groups it just returns the groupname!
Will look into this and get you a solution asap! |
Hey @joelfmrodrigues! I figured it out, it was a problem we had in the code before, because in single user fields there was a request to the sharepoint rest API with I changed it now so that the value from the single field gets fetched the same way as the values from the multiuser field! |
But I have no clue why the check failed now! |
@SmarterJB Many thanks for the super quick update. Went on debug and the issue seems to be in the foreach loop to parse the response items here: The response I received was not an array: And the following exception was captured Could you please have a look? |
Hey @joelfmrodrigues! I rewrote the single user method from before now it should work! |
@SmarterJB many thanks! This is now merged and should be available on the beta release in a few minutes. |
* Removed parsing the user ID from default value, because the ID is no longer in the peoplePicker default value * changed the 2 methods so that they do what the name intends - they return the default value for the peoplepicker with the UPN and not the ID * Get Single User Field the same way as the multiple users * rewrite getUserUPNById to getUserUPNFromFieldValue for single user values
What's in this Pull Request?
I changed the way the DynamicForm component fetches the initial data from user fields. I changed it to use the UPN instead of the ID, because as described in issue #1315, this leads to problems when "People and Groups" are enabled in the SharePoint field.
I had to also remove the parsing of the user IDs from the defaultValues, because there are no longer the IDs there.