• Fabio Scheurel
  • NEWBIE
  • 5 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies
Hi there,

I was wondering if the default value that I can specifiy for my fields on a list custom setting is usable for some kind of fallback. I would like to retrieve the default value if the stored value for a data set is NULL or a data set does not exist.

I know that I can retrieve the default formula with this call:
Labels__c.TextKeepInTouchDescription__c.getDescribe().getDefaultValueFormula()
However, it will just return a formula, but I need the evaluated result of that formula. Something like
String default = new Labels__c().TextKeepInTouchDescription__c;
just leaves me with a null value.

Any idea?
Every unit test example for APEX code retrieves the Profile using the following SOQL:
SELECT Id FROM Profile WHERE Name = 'System Administrator'
When I am deploying my unit tests to another Org, which has set another language (e.g. German), this SOQL won't work. The Profile.Name is always returned localized, in German it says "Systemadministrator".

How can I retrieve a profile from the database without being dependant of the user's language? Is there a default System.Label for standard profile names?

Hi there,

I would like to query a custom label in APEX based on a specific locale/language. Currently, when using Label.My_Label, the My_Label value is always returned using the current user's locale.

However, when performing specific actions like creating Tasks, Events etc. in a trigger, that trigger might run in a system user's or an API user context. However, the content in the Tasks, Events etc. should be localized for a specific contact. I have no idea how I can achieve such thing.

I appreciate your help, thanks!
Fabio
Every unit test example for APEX code retrieves the Profile using the following SOQL:
SELECT Id FROM Profile WHERE Name = 'System Administrator'
When I am deploying my unit tests to another Org, which has set another language (e.g. German), this SOQL won't work. The Profile.Name is always returned localized, in German it says "Systemadministrator".

How can I retrieve a profile from the database without being dependant of the user's language? Is there a default System.Label for standard profile names?

Hi there,

I was wondering if the default value that I can specifiy for my fields on a list custom setting is usable for some kind of fallback. I would like to retrieve the default value if the stored value for a data set is NULL or a data set does not exist.

I know that I can retrieve the default formula with this call:
Labels__c.TextKeepInTouchDescription__c.getDescribe().getDefaultValueFormula()
However, it will just return a formula, but I need the evaluated result of that formula. Something like
String default = new Labels__c().TextKeepInTouchDescription__c;
just leaves me with a null value.

Any idea?
Every unit test example for APEX code retrieves the Profile using the following SOQL:
SELECT Id FROM Profile WHERE Name = 'System Administrator'
When I am deploying my unit tests to another Org, which has set another language (e.g. German), this SOQL won't work. The Profile.Name is always returned localized, in German it says "Systemadministrator".

How can I retrieve a profile from the database without being dependant of the user's language? Is there a default System.Label for standard profile names?

Hi there,

I would like to query a custom label in APEX based on a specific locale/language. Currently, when using Label.My_Label, the My_Label value is always returned using the current user's locale.

However, when performing specific actions like creating Tasks, Events etc. in a trigger, that trigger might run in a system user's or an API user context. However, the content in the Tasks, Events etc. should be localized for a specific contact. I have no idea how I can achieve such thing.

I appreciate your help, thanks!
Fabio