-1

Normally we fetched the label name by using label.labelname in apex code but i want to fetch the label name by using variable in apex code.Anyone have idea?

0
0

Add the following method in your class.

public static String getLabelString(String labelName ){
    Component.Apex.OutputText output = new Component.Apex.OutputText();
    output.expressions.value = '{!$Label.' + labelName + '}';
    return String.valueOf(output.value);
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.