You need to sign in to do that
Don't have an account?
Ralfo A. Nunes
Using Apex: Custom Picklist field saved different values depending on User Language
When trying to set a value in picklist field using APEX for a custom object, we need to guarantee the same value disregarding the user current language when the record is saved.
Current code:
Custom_Object__c ojb = new Custom_Object__c();
ojb.Status__c = 'Liberado';
Org is working with 2 languages (Portuguese and English), where picklists are translated. Portuguese is default.
Issue: If we run as a user in English, the record is saved with the value 'Released' instead of 'Liberado'. That is, the value saved in the record is different depending on the user language, what is a big issue for the system logic.
Question: is this the standard behavior? How can we guarantee the same value using the APEX?
Current code:
Custom_Object__c ojb = new Custom_Object__c();
ojb.Status__c = 'Liberado';
Org is working with 2 languages (Portuguese and English), where picklists are translated. Portuguese is default.
Issue: If we run as a user in English, the record is saved with the value 'Released' instead of 'Liberado'. That is, the value saved in the record is different depending on the user language, what is a big issue for the system logic.
Question: is this the standard behavior? How can we guarantee the same value using the APEX?
E.g:
In translation Workbench: Picklist has value: Liberado (for Portuguese) and Released (for English).
If user is Logged in Portuguese, in Database is saved value as "Liberado"
If user is Logged in English, in Database is saved value as "Released"
Because that my logic program stop to work as it designed. I have a logic on this value, e.g: If (ojb.Status__c == 'Liberado') { Part of my program}