I created a Visual Workflow that launches after a user clicks a custom button on the Account page. I’m wondering if I can use Decision logic to evaluate certain attributes for the logged in user and their associated user page. Specifically I want to evaluate if the user (who clicked the button) is also the Account owner. If they are then it should take them to an input screen. If the user is not the Account owner, then I want to show a fault screen. How do I go about evaluating the current user?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
You should be able to use Global Variables for your scenario . Precisely you should be able to use {$!User.Id}
to get the Id of the User executing the visual workflow.
Note that global variables are present in formula .So you can create a formula and assign to a variable
Method 2
You need to pass them as parameters to the flow. You can use an extension controller.
<flow:interview name="FEPlacementRequest" finishLocation="{!EndPage}" interview="{!placementInterview}"> <apex:param name="UserName" value="{!$User.FirstName}"/> </flow:interview>
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0