-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

1 Answer 1

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);
}

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.