I need to evaluate the current user running a flow. Someone suggested I use the Global Variable {!User.Id}, but it's returning a 15 digit Id. I need to compare the current user with the Account owner. The Account Owner field is returning an 18 digit id. Is there another way to evaluate the current user in my flow and compare it to an Account owner?

The above resolution doesn't really work for my purposes for evaluating a user if I can't compare the user to the Account Owner ID. In the above example, the Account Owner will never = the current user as it is comparing a 15 digit id to a 18 digit id. Is there a way turn the User ID from the Global Variables into 18 digits? Or vice versa, make the Account Owner ID return as 15 digits? Thanks so much!


You can use the CASESAFEID formula in the Flow to get the correct ID:


At this point, you'll be able to safely compare the OwnerId to the logged-in user's ID.

| improve this answer | |
  • 1
    The question is on flows and not on the Visualforce page .The user is doing this in flows – Mohith Shrivastava Apr 20 '16 at 21:29
  • @MohithShrivastava As far as I know, you can't directly reference $User in a flow-- you have to use a Visualforce page. – sfdcfox Apr 20 '16 at 21:32
  • @MohithShrivastava Cool, I guess I hadn't seen formulas recently. I'll update my answer. – sfdcfox Apr 20 '16 at 21:41

Create a formula field on the Account record which will Convert your 18 digit to 15 digit .You can use LEFT function on the Account Object and store the 15 digit there as a formula field .


You can use this new formula field for your comparison .

| improve this answer | |
  • Could there not be a scenario, albeit quite rare, where the Account Owner 15 char Id is equal to another Account Owner 15 char Id (as 15 char Ids aren't unique)? Thanks – Andy Hitchings Apr 22 '16 at 14:30
  • 1
    @AndyHitchings If you truncate last three digits then they are unique .15 digits are case sensitive but they are unique .Check this help.salesforce.com/apex/HTViewSolution?id=000004383 – Mohith Shrivastava Apr 22 '16 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.