cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Show information about another user (taken from Office 365) and complete fields automatically

Basicaly, I want to make a form where some of the fields (name, job title, department, etc) will be autocompleted so the user won't have to complete them by hand.

 

 

Based on the full name, I want other fields to populate automatically. Can that be done? I'm using a "Person or Group" type of column for the name, so you can search users and don't make mistakes mispelling names, etc.

 

Thanks

 

 

6 REPLIES 6
K-A-R-L
Level 10

Re: Show information about another user (taken from Office 365) and complete fields automatically

Hi @Anonymous ,

Are you using forms or galleries?

You might need to add the Office365 connection for this.


OnStart Property of the app:

Set(
MyProfile,
Office365Users.MyProfile()
);
 


*Gallery*

You can use the codes below on your fields:



Office365Users.UserProfile().Department
Office365Users.UserProfile().DisplayName
Office365Users.UserProfile().GivenName
Office365Users.UserProfile().Id
Office365Users.UserProfile().JobTitle
Office365Users.UserProfile().Mail
Office365Users.UserProfile().MailNickname
Office365Users.UserProfile().Surname
Office365Users.UserProfile().TelephoneNumber
Office365Users.UserProfile().UserPrincipalName
Office365Users.UserProfile().AccountEnabled


*Forms*
On the field you want to be automatically populate you need to add this:

Office365Users.UserProfile(MyProfile).mail


Please check this link.

Cheers


Anonymous
Not applicable

Re: Show information about another user (taken from Office 365) and complete fields automatically

I'm using forms.

 

I don't need to get my profile (or the profile of the user who's filling the form) but rather get the profile of another user (selected in a dropdown).

 

Anyone can fill this form and input another user's data. I need to populate the fields with that user's data.

 

Example, I'm logged in with my Office 365 profile, I'm Lucas, but I need to fill the form for Justin, so I need the fields to auto populate with Justin's information without me having to type it in.

AlexN
Level 8

Re: Show information about another user (taken from Office 365) and complete fields automatically

As @K-A-R-L said, you can use the Office365users connector. So when you want to receive the info from a user with the e-mail john.doe@contoso.com, you would use the formula:

Office365Users.UserProfile("john.doe@contoso.com").Department;

Anonymous
Not applicable

Re: Show information about another user (taken from Office 365) and complete fields automatically

Problem is, not everyone knows the email of the other user.

 

Despite that, I tried using the email, so I created a text input field where the user types the email, and used the following formula in the other fields I want to populate:

 

Office365Users.UserProfile(TextInput1.Text).Department

 

It detects the email, but the result of the flow is 404. Doesn't seem to be working.

K-A-R-L
Level 10

Re: Show information about another user (taken from Office 365) and complete fields automatically

Hi @Anonymous ,

I can give you a better solution instead of using dropdown try the Office365Users.SearchUser function.

 

Please watch this video.

I added a gallery and a searchTextInput to search for Office365 users that will automatically populate the forms:


*Screen*
OnVisible Property: 
UpdateContext({Selected:false});


*Gallery*
Item:

If(Not(IsBlank(Trim(SubmitToSearchInput.Text))),Office365Users.SearchUser({searchTerm:Trim(SubmitToSearchInput.Text)}))

OnSelect property:

UpdateContext({Selected:true});
Set(SelectedDisplayName, ThisItem.DisplayName);
Set(SelectedDepartment,ThisItem.Department);
Set(SelectedGivenName, ThisItem.GivenName);
Set(SelectedID,ThisItem.Id);
Set(SelectedEmail, ThisItem.Mail);
Set(SelectedJobTitle,ThisItem.JobTitle);
Set(SelectedSurname, ThisItem.Surname);
Set(SelectedUserPrincipalName,ThisItem.UserPrincipalName)


*Forms*
You need to unlock all the data card value:

Set the Default of each Datacard values to corresponding data field that you want:

e.g On Department Datacard Default Property:
If(Selected = true, SelectedDepartment)

Let me know if you're having trouble.

Cheers

Administrator
Administrator

Re: Show information about another user (taken from Office 365) and complete fields automatically

Hi @Anonymous can you review the above reply and update the thread if it was helpful? 

 

Thank you,

 

@TopShelf-MSFT 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 363 members 6,536 guests
Please welcome our newest community members: