I would like to be able to hide/show a button based on who is logged in. Here is a basic overview of what I'm trying to do.
My app tracks sales opportunities. One user will register the opportunity and other users can be added as team members to the opportunity. Both users can view the opportunity details and perform various tasks related to the opportunity. For example, I have created a Menu View with a button to a connected quote request form. However, two of the menu buttons I have created are designed to "Win" or "Lose" the opportunity. I only want the registering user to have access to these buttons, not the team members. I moved these buttons to a separate view thinking I could use a Page Rule to hide it based on the logged-in user but logged-in user is not an option.
This is also something I am trying to figure out how to do, Did you ever figure it out?
@Mike1 You can do this custom code unless @John_Prescriptive.Solutions has other suggestions.
- You can get the logged-in user with
- Compare the logged-in user with the Details on the page, to hide certain menu buttons.
@Mike1 So the field I use to connect the users to the opportunity is a many-to-many connection, which I believe, is why I cannot set a hide view rule based on the logged-in user. What I ended up doing was creating a separate field in the object that tracked only the registered owner of the opportunity. Because this is a one-to-many relationship I now have to option to hide view based on the logged-in user showing in this new field. I moved the buttons a need to hide from certain users to a separate view and created the relevant rule. It doesn’t look as clean as I would like it but it works. My guess is if you go the custom code route the UI would look better but I’m not advanced enough to use custom code that I can’t simply copy and paste. Hope this helps you in your application.