Skip to content
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

People Picker should have ability just to display inactive users name (ideally the value fetched from 'Author/Title') #768

Closed
sankarkumar23 opened this issue Dec 19, 2020 · 9 comments
Labels
status:fixed-next-drop Issue will be fixed in upcoming release. type:enhancement New feature or enhancement of existing capability
Milestone

Comments

@sankarkumar23
Copy link
Contributor

sankarkumar23 commented Dec 19, 2020

Enhancement.

People Picker should have the ability to assign the person (IPersonaProps) directly. This is useful just to display the inactive users when you have people picker in Edit form.. Just like how SharePoint lists users in Person column even the users' accounts are no longer valid.

Currently I am forced to show blank when you Edit the form this is very confusing to the end users.

We can fetch username from user field though the user is inactive.. for ex: (_api/web/lists('listid here')/items(1)?$select=ID,Author%2FTitle&expand=Author). This 'Title' would be displayed in OOB people picker box though the user is not active. Similarly we should also be able to assign the value to the PnP's people picker control.

Otherwise again we need to depend on NormalPeoplePicker to achieve this behavior.

This is somewhat related to the below issue
#SharePoint/sp-dev-docs#5970
We all know SharePoint does not resolve the inactive users.. its SharePoint behavior.. nothing we can do there..
The issue can be resolved if we can provide the ability to display the username in the picker's textbox.

Here is my thought for fix.
Change the defaultSelectedUsers property from string or IPersonaProps
Ideally inactive users email would be null in OOB SharePoint... When email is null/empty just display the given 'initials' and 'text'.. if email has value just continue the current functionality. Basically apply filter to 'selectedPersons' and play around.

Of course.. need to update the document...on how to bind inactive users?

@ghost
Copy link

ghost commented Dec 19, 2020

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

@ghost ghost added the Needs: Triage 🔍 label Dec 19, 2020
@sankarkumar23 sankarkumar23 changed the title People Picker should have ability just to display inactive users name (Ex: 'Author/Title') People Picker should have ability just to display inactive users name (ideally the value fetched from 'Author/Title') Dec 19, 2020
@sankarkumar23
Copy link
Contributor Author

sankarkumar23 commented Dec 24, 2020

Can this be triaged quickly? This is a basic requirement and without this the control cannot be used for Edit forms. It's pretty much limited to New Forms. Also, it appears many people are looking for this implementation. Appreciate your response soonest.

@sympmarc
Copy link

@sankarkumar23 - Understand that this is an open source effort and everyone here volunteers their time to create these resources. You're also asking right in the middle of a time of year when many people are taking time off to spend the holidays with their families. The team here will take a look at this when they can. If your request seems as if it will benefit the larger community, they may implement it. Reminder: open source means you can contribute the fix/change, too.

@sankarkumar23
Copy link
Contributor Author

sankarkumar23 commented Dec 26, 2020

I made the fix and created a pull request. Please review and accept if fix makes sense.
Currently the defaultSelectedUsers is accepting email or login name in string [].. I just extended it to accept the user title optionally appending /title to email or login name.

example:
defaultSelectedUsers={["test@test.com/usertitle"]}

@AJIXuMuK AJIXuMuK added status:fixed-next-drop Issue will be fixed in upcoming release. type:enhancement New feature or enhancement of existing capability and removed Needs: Triage 🔍 labels Dec 27, 2020
@AJIXuMuK AJIXuMuK added this to the 2.4.0 milestone Dec 27, 2020
@AJIXuMuK
Copy link
Collaborator

Thank you @sankarkumar23 for reporting this one and creating a PR.

@sankarkumar23
Copy link
Contributor Author

Thank you @sankarkumar23 for reporting this one and creating a PR.

@AJIXuMuK - Could you please push #773 also to 2.4.0

@sankarkumar23
Copy link
Contributor Author

sankarkumar23 commented Jan 6, 2021

@AJIXuMuK - I have enhanced the fix as previous fix forces to verify the user is active or inactive before hand. With this new code if user is not found, ideally inactive user, the appended title will be shown. Appreciate your review. Also please see if this change can be pushed with 2.4.0

Still got a punch because of pnp/pnpjs#778. EMail is not available (in expand) for userfield with multi-select. Either you get email from sp.web.getUserById(id#) or just settle with Title field (user image will be missed). If userfield is not multi-select there is no need to call sp.web.getUserById since "expand" itself provides both Title and EMail (can be blank for inactive users).

defaultSelectedUsers={["test@test.com/usertitle"]} //email can be active or inactive user's.
or
defaultSelectedUsers={["/usertitle"]} // this also works and just binds the title.

@AJIXuMuK
Copy link
Collaborator

AJIXuMuK commented Jan 6, 2021

Hi @sankarkumar23,

I've merged your latest update.

@sankarkumar23
Copy link
Contributor Author

Thank you @AJIXuMuK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:fixed-next-drop Issue will be fixed in upcoming release. type:enhancement New feature or enhancement of existing capability
Projects
None yet
3 participants