4

I have looked at this question but this is not working and I have the exact same requirement where I will have to pass the parameter to a custom label

string parameter = 'this is a test';
string label =  System.Label.test;
String value = String.format(label, parameter); 
System.debug('//' + value);

Here is the error:

Variable does not exist: String

1 Answer 1

8

You need a List to send 'parameter'

String value = String.format(label, new List<String>{ parameter });
2
  • ah ha got it...
    – Nick
    Sep 6, 2016 at 20:24
  • Yeah, it looks like some SFDC error messages are not clear/helpful enough :P. A String.format(String, String) method doesn't exist would be more accurate I think.
    – Joca
    Sep 6, 2016 at 20:50

You must log in to answer this question.

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