Hi
If you want to achieve that via JS, you can see the roles via JS and show/hide fields
this code gets the user roles
$(document).ready(function () {
var roles = "{{ user.roles }}";
var isAdmin = "{{ user | has_role: 'Administrators' }}"
console.log("Is Admin: " + isAdmin);
console.log("User Roles: " + roles);
});
Take a look at this post if you need the code to hide/show fields: http://oliverrodrigues365.com/2020/07/19/power-apps-portals-javascript-tip-01-hide-show-elements/
that's if you want to do via JS, take in consideration that this is not the most secure way, as a user could display the fields via browser dev tools, or even disable JS on the browser
if you want to achieve that in a more secure way, I would suggest the following:
- Duplicate your components - Web Pages / Entity Form / CDS Form, etc
- Create a Web Page Control Access Rule for the "admin" page, allowing only admin users to access that page
hope this helps
------------
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.