cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ragavanrajan
Super User
Super User

Enable dropdown value depends on web role

Hello Experts, 

 

      I have a scenario where I need to display and enable only one value depends on the web role. Here is the detailed scenario. 

I have a web page where I am currently having Checkbox (achieved through meta data) where a manger can choose multiple choice. 

The business rule is changing. Hence I need to restrict each manger, and allowing them to select only one value. I thought may be this is possible through dropdown. But open to any kind of solution. 

 

Currently I have a SharePoint list where my list contains manager email address and the values they can choose. Is there anyway I can integrate this list to CDS to achieve the above scenario ? 

In a nutshell, what is the best way to solve the problem ? 

 

Thanks 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
OliverRodrigues
Super User
Super User

Hi, I don't really think you can achieve that using normal Portals configuration

you can apply JS and filter the options based on the user's role

the following JS is an example on how to check the web roles for the signed-in user:

$(document).ready(function () {
var roles = "{{ user.roles }}";
var isAdmin = "{{ user | has_role: 'Administrators' }}"
console.log("Is Admin: " + isAdmin);
console.log("User Roles: " + roles);
});

 




If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Apps Portals Super User


Oliver Rodrigues


 

View solution in original post

2 REPLIES 2
OliverRodrigues
Super User
Super User

Hi, I don't really think you can achieve that using normal Portals configuration

you can apply JS and filter the options based on the user's role

the following JS is an example on how to check the web roles for the signed-in user:

$(document).ready(function () {
var roles = "{{ user.roles }}";
var isAdmin = "{{ user | has_role: 'Administrators' }}"
console.log("Is Admin: " + isAdmin);
console.log("User Roles: " + roles);
});

 




If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Apps Portals Super User


Oliver Rodrigues


 

ragavanrajan
Super User
Super User

Thanks @OliverRodrigues , It helped a lot to write my custom logic to achieve what we wanted to do. But I think I am half way through to achieve this. 

Helpful resources

Announcements
Welcome Super Users.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,470)