Reputation: 21
I have 2 lists in SharePoint.... List 1: Request List & List 2: Approver List.
User selects new and PowerApps form displays where the employee enters his request.
Request List fields...
Leave Date(Date field)
Employee(Person field)
Department (Text)
Approver (Person field "AutoFill")*
* Once employee enters their name in the Request form I want the form to lookup his Approver in List 2 and then prefill the Approver field.
Approver List fields.....
Employee (Person field)
Approving Manager (Person field)
Department (Text)
Can someone suggest a good way to make this work. Lookups and Cascading lookups not the solution.
Carlos... Here are some screen shots of the configuration....
Effects after adding suggested code
Upvotes: 2
Views: 3741
Reputation: 87318
A lookup is a solution for this, but in PowerApps, not in SharePoint. Here's how you would go about implementing this:
Approver_DataCard1
or something similar)Now we can start updating the properties that will perform the lookup. Click the "More options" button to show all properties of the card, and search for Default
. Set its value to
If
IsBlank(DataCardValue3.Selected),
Blank(),
LookUp(
ApproverList,
Employee.Email = DataCardValue3.Selected.Email,
ApprovingManager))
Where DataCardValue3
is the name of the control (a combo box control) that is used to select the employee for who the request is being made.
Now every time the employee is changed, it will look at the ApproverList on SharePoint for an employee whose e-mail is the same as the one for the selected employee.
If you don't want to give the form user the option to override the default approver, you can also update the DisplayMode
property of the data card for the approver to DisplayMode.View
so that it will only show the approver to the user, without letting them change it.
Hope this helps!
Upvotes: 1