You need to sign in to do that
Don't have an account?
JGF
SOQL Automated Process by its name changes with the users profile locale
Hello everyone,
I have a very peculiar situation. For the creation of a particular record I need the Automated Process User Id, up to now this is the way I obtained it.
Now this previous Query does not work as the name for the "Automated Process" user has changed to "Process Automated", giving 0 results for this query.
Is there a proper way to retrieve this "Automated Process" user without having the name issue because the Users locale?
I have a very peculiar situation. For the creation of a particular record I need the Automated Process User Id, up to now this is the way I obtained it.
[SELECT Id FROM User Where Name = 'Automated Process']Everything was correct until a new user arrived that set his profile Locale to Chinese.
Now this previous Query does not work as the name for the "Automated Process" user has changed to "Process Automated", giving 0 results for this query.
Is there a proper way to retrieve this "Automated Process" user without having the name issue because the Users locale?
The answer given by Siddharth Mani gave me the idea to query the user by his alias, that it always be autoproc regardless of the Locale or language configuration.With this the org ID will not get in the way.
[SELECT Id FROM User Where alias = 'autoproc']
All Answers
In the above query, the Id parameter i.e. "00h2b000005hunoeao" is the 18 digit org id which you obtained above.
If you want a more generic version where you dont want to use the organization id then you can try this:
The above query obviously asumes that you do not have another user in your org with 'autoproc@' in the username.
You have to Use toLabel(fields) to translate SOQL query results into the user’s language.
Please follow https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_tolabel.htm
Let me know if this is helpful by marking the answer as solved so that it can help others in the future
Anudeep
The answer given by Siddharth Mani gave me the idea to query the user by his alias, that it always be autoproc regardless of the Locale or language configuration.With this the org ID will not get in the way.
[SELECT Id FROM User Where alias = 'autoproc']