0

I'm using Workbench to perform queries.

I would like to get information about the currently logged in user. In Apex we can use the UserInfo object e.g.

Id userId =UserInfo.getUserId(); 
User example = [SELECT CurrencyIsoCode FROM User WHERE Id =: userId];

How would I perform a SOQL query in Workbench that returns information about the currently logged in user. e.g. SELECT CurrencyIsoCode from User Where Id = CurrentUserId?

EDIT: I thought I'd also clarify, I'm not just trying to get the currency for the currently logged in user. I am trying to query on other records (e.g. return all Accounts owned by currently logged in user). I'm also trying to do this without changing the SOQL per user. I need it to work regardless of which user executes the SOQL.

  • You're using Workbench and want the current user id? I assume you're logged in with your salesforce user id. You just need to find the id related to your user and put it in your query as a string. – Martin Lezer Oct 3 at 13:59
0

you don't need to perform SOQL query in workbench to get info what ever you want, once u logged in to workbench in top right corener you get user session info link, you just need to click like in image , then you get current user sesssion resultsenter image description here

  1. if you need to perform SOQL only then first get user id then perform SOQL like below.

    SELECT CurrencyIsoCode FROM User WHERE Id = '005t000000xxxxxxx'

enter image description here

  • That works for getting a currency, but say I wanted to query all of the Accounts the current logged in user has. This method requires changing the query per user. Is there a way to do it so it works with any logged in user without changing the SOQL? – Adam Oct 4 at 7:31

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.