function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jyoti Ranjan PandaJyoti Ranjan Panda 

What is the query to get userid of a active user

What is the soql query to get userid of a active user .
Best Answer chosen by Jyoti Ranjan Panda
SwethaSwetha (Salesforce Developers) 
HI Jyoti,
You can use the below query if you know the username of the specific user
SELECT Id
FROM User
WHERE IsActive = true
AND Username = 'user@example.com'  // replace with the email or username of the user

If this information helps, please mark the answer as best. Thank you

All Answers

Eswar Venkat 2Eswar Venkat 2

SELECT Id FROM User WHERE IsActive = true

 

If it helps please mark as best answer .

https://t.me/+mJhFHjoWExg3MTQ9

SwethaSwetha (Salesforce Developers) 
HI Jyoti,
You can use the below query if you know the username of the specific user
SELECT Id
FROM User
WHERE IsActive = true
AND Username = 'user@example.com'  // replace with the email or username of the user

If this information helps, please mark the answer as best. Thank you
This was selected as the best answer
Prateek Prasoon 25Prateek Prasoon 25
Text
      
    
    
    
      SELECT Id FROM User WHERE IsActive = true AND Username = 'user@email.com'

If you find my answer helpful, please mark it as the best answer. Thanks!