cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kumar9024021
Level: Powered On

Populate SharePoint list Approver dropdown with Job Title VP from User Profile - SharePoint Online

Hi,

I have a SharePoint online list which has a dropdown field called Approver. This approver dropdown should show the users whose Job Title is Vice President of respective dept.

For example: I am from logistics dept. Hence i should see only the Vice President from logistics department in the dropdown. Similarly, other dept should see only their dept VP.

I have details of all users department, jobtitle in SharePoint online user profiles, SQL Server DB. 

Once the approver is selected, there should be an email sent to him on submitting the form. I am new to powerapps hence unable to decide.

Any technical advice if this can be achieved through powerapps (or) require REST API custom coding ? Thanks

11 REPLIES 11
Super User
Super User

Re: Populate SharePoint list Approver dropdown with Job Title VP from User Profile - SharePoint Online

@Kumar9024021 

I assume that each department in your organization would have only a single Vice President correct? If yes you could use the Offfice 365 Users connector to detect the current user's department

 

Office365Users.MyProfileV2().department

 

Then you could maintain a list of the email address of the current VP for each department and perform a LookUp to return the manager based on the logged in user.

 

Approvals are best managed by MS Automate (formerly MS Flow)  They can be integrated with PowerApps. Suggest you check out the approvals capabilities including sending emails over there.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

 

Kumar9024021
Level: Powered On

Re: Populate SharePoint list Approver dropdown with Job Title VP from User Profile - SharePoint Online

Hi,

 

Actually we are populating VP, Senior VP in approver dropdown for each department. It will definitely be more than 1 approver in the dropdown.

Super User
Super User

Re: Populate SharePoint list Approver dropdown with Job Title VP from User Profile - SharePoint Online

The proposed solution doesn’t really change much in this scenario. For every department you would define all of the needed approvers instead of just one approver
Community Support Team
Community Support Team

Re: Populate SharePoint list Approver dropdown with Job Title VP from User Profile - SharePoint Online

Hi @Kumar9024021 ,

Could you please share a bit more about the Approver field in your SP list? Is it a Person type column?

Do you want to filter the Approver Dropdown box options list to only display users whose Job Title is Vice President of respective dept?

Do you use a SP list to store the all users' profile?

 

I assume that the Approver field is a Person type column in your SP list, and you want to filter the Approver Dropdown box options list to only display users whose Job Title is Vice President of respective dept, is it true?

 

I have made a test on my side, please consider take a try with the following workaround:

1. If the Approver field is a Person type column in your SP List:

Set the Items property of the Approver ComboBox within the Edit form to following:

Filter(
       Choices([@'YourSPList'].Approver), 
       Office365Users.MyProfile().Department in JobTitle
)

Note: Here you could not see the list of user options when you click the Approver ComboBox, you need to type search key within the ComboBox, so the related options could show up. It is an known issue with Person type column in SP List.

 

If you want to see all available user options when you click the Approver Person field ComboBox, please consider take a try with the following workaround:

Set the Items property of the Approver ComboBox to following:

Filter(
       Choices([@'YourSPList'].Approver), 
       Office365Users.MyProfile().Department in JobTitle
)

Set the IsSearchable property of the Approver ComboBox to following:

true

Set the Update property of the Approver Data card which contains the Approver ComboBox in your Edit form to following:

ForAll(
      ApproverComboBox.SelectedItems,
      {
      Claims: "i:0#.f|membership|" & Lower(Mail),
      DisplayName: DisplayName,
      Email: Mail,
      Department: "",  
      JobTitle:"", 
      Picture:""
     }
)

then configure the Approver ComboBox as Person layout as below:

4.JPG

Note: I assume that you have enabled "Allow multiple selections" option for the Approver field in your SP List.

 

2. If the Approver field is just a Choice type field in your SP List, which list the available users, please consider modify above formula as below:

Filter(
       Choices([@'YourSPList'].Approver), 
       Value in Filter(Office365Users.SearchUser(), Office365Users.MyProfile().Department in JobTitle).DisplayName
)

 

For your second question, do you want to send an email to the selected approver when you submit the form data? I think the OnSuccess property could achieve your needs:

1. If the Approver field is a Person type column in your SP List:

Set the OnSuccess property of the Edit form to following:

Office365Outlook.SendEmail(
                            EditForm1.LastSubmit.Approver.Email, 
                            "Email Subject", 
                            "Email Body"
);
Back()

2. If the Approver field is a Choice type column in your SP List:

Office365Outlook.SendEmail(
                            LookUp(Office365Users.SearchUser(), DisplayName = EditForm1.LastSubmit.Approver.Value, Mail), 
                            "Email Subject", 
                            "Email Body"
);
Back()

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Kumar9024021
Level: Powered On

Re: Populate SharePoint list Approver dropdown with Job Title VP from User Profile - SharePoint Online

Hi,

 

Thanks a lot for your response.

 

Approver field is a dropdown which should show only my department VP's, senior VP's.

 

Sameway, other department users should only see their VP's, Senior VP's.

 

All these user profile details are only in SharePoint User Profile/SQL Server DB. There is no separate list for all user profiles.

 

 

Community Support Team
Community Support Team

Re: Populate SharePoint list Approver dropdown with Job Title VP from User Profile - SharePoint Online

Hi @Kumar9024021 ,

Have you taken a try with the solution I provided above?

 

Based on the needs that you mentioned, I think the solution I provided above could achieve your needs. Please consider take a try with it, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Kumar9024021
Level: Powered On

Re: Populate SharePoint list Approver dropdown with Job Title VP from User Profile - SharePoint Online

Hi @v-xida-msft,

 

I tried the below solution in the New Form Items property . However, I notice that the line Office365Users.MyProfile..... is not accepting. It shows some error Name isn't valid. Identifier is not recognized. Image attached.

 

 

Community Support Team
Community Support Team

Re: Populate SharePoint list Approver dropdown with Job Title VP from User Profile - SharePoint Online

Hi @Kumar9024021 ,

If you want to use Office365Users function in your PowerApps app, you need to add Office 365 Users connection as data source in yout app firstly.

 

More details about adding Office 365 Users connection into your app, please refer to the following link:

https://powerapps.microsoft.com/en-us/tutorials/connection-office365-users/

 

Then you could set the Items property of the ComboBox to following:

Filter(
       Choices([@'YourSPList'].Approver), 
       Value in Filter(Office365Users.SearchUser(), Office365Users.MyProfile().Department in JobTitle).DisplayName
)

 

Please take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Kumar9024021
Level: Powered On

Re: Populate SharePoint list Approver dropdown with Job Title VP from User Profile - SharePoint Online

Hi @v-xida-msft ,

 

Thanks for your quick response. I have added the data source and error went away. Sorry, I am new to Powerapps and hence finding difficult to spot basic things. I tried adding the below snippet in items Property, however it doesn't return anything. Its empty.

 

Filter(

Choices(ESR1.Approver),
Value in Filter(Office365Users.SearchUser(), Office365Users.MyProfile().Department in JobTitle).DisplayName
)

 

My objective is every department users should see their own Vice President, SVP as approver in the dropdown. My approver dropdown doesn't have any choices initially. All choices are being populated from user profiles.

 

 

 

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 (Last 30 Days)
Users online (7,007)