7

I was wondering if somebody would be able to assist with an issue I am encountering with my SOQL query. A user changed his local language to Dutch and now one of my SOQL queries is not returning the required information. I have found that this is due to the word 'standard' in English is 'standaard' in Dutch. I contact Salesforce support for assistance and they have declared that there is no way to query for a non localized user types.

The query is as follows:

SELECT Id,IsActive,FirstName,LastName,Name,UserRole.Name,Title,Profile.Name,UserType 
FROM user 
WHERE IsActive = true 
    AND (FirstName like '%' OR FirstName = null) 
    AND (LastName like '%' OR LastName = null) 
    AND (UserRole.Name like '%' OR UserRole.Name = null) 
    AND (Profile.Name like '%' OR Profile.Name = null) 
    AND UserType like 'Standard%'
ORDER BY Name ASC LIMIT 201

I am searching by standard as I wish to avoid searching for portal users.

Any help you can provide will be greatly appreciated.

UPDATE: After a lot of emails back and forth and a remote session, Salesforce have acknowledged that this is a bug on their side. They have added this to 'Known Issues' so if people could click on 'This Issue Affects me', that would be fantastic! https://success.salesforce.com/issues_view?id=a1p300000008XUPAA2

Best Regards,

Kevin

4
  • I'm not aware of how translation works in salesforce, but shouldn't it only be visual? With other words: shouldn't you only change the text that's shown to the user and not variable names/types/anything else?
    – Novarg
    Nov 24, 2014 at 12:35
  • Hi Novarg, thanks for the reply. Unfortunately this query requires the text to be translated to the user's language. For example, if I wish for the above query to return any data while the user is using the Dutch language then the second last line must be AND UserType like 'Standaard%'. This is not ideal as it will require having the translation for standard in all languages and we will have to adapt our code etc.
    – KevinC123
    Nov 24, 2014 at 15:38
  • can you make a global variable which will contain all translations for Standard in all languages that you use? For example a set of strings. Then you could change that second last line to AND UserType IN :yourGlobalVariable
    – Novarg
    Nov 24, 2014 at 15:41
  • Hi Novarg, thank you for the the recommendation. We are going to implement something similar as a quick hack for the moment and hopefully Salesforce will fix the overall issue soon which is a part of their 'Known Issues'. success.salesforce.com/issues_view?id=a1p300000008XUPAA2
    – KevinC123
    Dec 3, 2014 at 10:57

1 Answer 1

2

Salesforce inadvertently solved our issue. I changed the operator from being 'like' to '=' and changed 'Standard%' to 'Standard' and have found that it works with every language. The updated SOQL query is:

SELECT Id,IsActive,FirstName,LastName,Name,UserRole.Name,Title,Profile.Name,UserType FROM user WHERE IsActive = true AND (FirstName like '%' OR FirstName = null) AND (LastName like '%' OR LastName = null) AND (UserRole.Name like '%' OR UserRole.Name = null) AND (Profile.Name like '%' OR Profile.Name = null) AND UserType = 'Standard' ORDER BY Name ASC LIMIT 201

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .