cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Agerde
Helper I
Helper I

Autofill Manager, Team lead, Assistant Manager from ComboBoxes

I am trying to AutoFill boxes and auto send an email to the manager / Team Lead upon form submission.

 

I am getting errors all the time... 

 

Currently I am trying to type: Office365Users.Manager(DataCardValue3.SelectedItems.Text).DisplayName 

The entire thing gets an error. The first says that "Manager has an invalid function. ".Text" is a wrong Identifier. and "DisplayName" Expected Record Value. 

 

I can't find other answers I have looked.... 

 

DataCardValue3 is the name of the First Dropdown box in my form which is where a user will input the Employee name that I need the manager, team lead and assistant manager of. The Card name is Employee_DataCard1.

 

Any help is appreciated.

17 REPLIES 17
yashag2255
Dual Super User II
Dual Super User II

@Agerde 

 

You are getting this error, maybe because your DataCardValue3 is a combobox control, which holds the records, rather than keeping a single value stored in Result/Value like dropdown. So you can modify your DefaultSelectedItem as :
 
[Office365Users.Manager(DataCardValue3.Selected.Mail).DisplayName]
 
Here the only change is to fetch the correct attribute from the main combobox, I don't know the name of your attribute, so I have placed "Mail" there, bacause mostly Office365 connectors use Mail. Please replace it with the attribute that holds value in your case. The powerapp will give a popup suggestion if you will just write "DataCardValue3.Selected.", then select the value and this should resolve your error.
 
Same could be done for the other two fields as well.
 
Hope this Helps!

View solution in original post

Agerde
Helper I
Helper I

@yashag2255 

 

Voila!! it works. For the Team lead one. If I try to then take the formula down to the next combobox in the series for the Assistant Manager it gives an error. 

 

Here, I have the 4 combo boxes in order.

 

Employee:

(Combo Box) ---DataCardValue3

Team Lead:
(Combo Box) --- DataCardValue21

Assist. Manager:

(Combo Box) --- DataCardValue 28

Manager:

(Combo Box) --- DataCardValue13

 

The only way I can figure it out is I input the [Office365Users.Manager(DataCardValue3.Selected.Email).DisplayName] into the Team Lead Combo Box and it filled in the Team Lead, NOT the Employee Manager. 

 

So I figured I would need to input [Office365Users.Manager(DataCardValue21.Selected.Email).DisplayName] into the DefaultSelectedItems spot of the Assistant Manager to then get the Assistant Manager of the Team lead.

 

But I get an error stating " The Method 'Manager' has an invalid value for parameter 'userID'" WHich I think means it is  not seeing the Team lead name now to pull the Assistant manager?

 

I found a thread that contains a formula that helps with the error,

 

[If(!IsBlank(DataCardValue21.Selected.Email),Office365Users.Manager(DataCardValue21.Selected.Email).DisplayName)]

 

This makes it so there is no error, however, it does not populate a name into the Assistant Manager Field still. I am still going through and researching to find a fix.

yashag2255
Dual Super User II
Dual Super User II

@Agerde 

The problem here is:
 
Even if we select a default value in a combobox, it still does not set that as the selected, it shows the user that something has been selected but when you try to print it somewhere, it doesn't work. So mainly its just a viewable content.
 
If you want a workaround for this, you might want to setup a variable as soon as the value of your employee combobox is changed and use the variable instead of using the direct ThisItem.Email, you can set these variables, each for three different comboboxes, on the onChange property of Combobox1(Employee) and then use them in the respective combobox DefaultSelectedItems.
 
If you don't want to go with the above process, they maybe you can switch to a dropdown and this will resolve your issues in a single go.
 
Hope this Helps!

@yashag2255 

 

I am going to try this. I really want to learn powerapps more, we previously used InfoPath in our work but it is becoming obselete so trying to teach myself PowerApps... 

 

So, where do I set the variable exactly? on the Employee OnChange? or on each of them individually?

 

Right now, on the OnChange for Team Lead - DataCardValue21, I have Set(TeamLead,DataCardValue21.Selected)

 

Then on the Assistant Manager Field - DataCardValue28, I have in the DefaultSelectedItems Box, [If(!IsBlank(TeamLead.Email),Office365Users.Manager(TeamLead.Email).DisplayName)]. I am getting no errors, but it is not populating anything. I keep trying to look for things on this forum board and other google lists, but I am not failing... I really appreciate ALL your help with this as I am new. Thank you thank you.

yashag2255
Dual Super User II
Dual Super User II

@Agerde 

 

You can add the variables on the OnChange property of Employee combobox, to set the email variable for all the three other comboboxes.
 
OnChange:
Set(EmployeeEmail, DataCardValue3.Selected.Mail)
Set(ManagerEmail, Office365Users.Manager(EmployeeEmail).Mail);
Set(AssistantManagerEmail, Office365Users.Manager(ManagerEmail).Mail);
Similar variable can be created for Team Lead.
 
Now, moving forward to the combobox's defalutSelectedItems, now instead of putting control values, you can input the variable that holds the email address of each required personal.
 
[Office365Users.Manager(EmployeeEmail).DisplayName] or
[Office365Users.Manager(ManagerEmail).DisplayName]

Please let me know in case you have any other issues.
 
Hope this Helps!

@yashag2255 you sir!!!! Are my Hero! I thought that is how you meant to do it, but I think I kept typing it in slightly wrong and it was not allowing me to set variables that way. This worked! I'd hug you if I could! 

 

I tried pretty much all day yesterday rearranging things and couldn't get it, hopefully if I keep at it. I'll get to your skill here. 

 

Now off to make a submit button on the bottom of my form to send an email to those 3 Managers for the employee once form is submitted. Thank you again sir!

yashag2255
Dual Super User II
Dual Super User II

Hey @Agerde Glad that it worked. Please post if you need any more assistance on this!

 

Thanks, 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,486)