You need to sign in to do that
Don't have an account?
Nikhil Gupta 202
Get label for a given record Id
Id recordId = 'xyz';
String objName = recordId.getSObjectType().getDescribe().getName();
I found the object Name but I also want Label for this recordId. How to use getLabel() on a given recordId?
String objName = recordId.getSObjectType().getDescribe().getName();
I found the object Name but I also want Label for this recordId. How to use getLabel() on a given recordId?
Hi charu,
Sorry but I want label of that record not the name. label will have translated value of name.
To get the label we have getLabel(). but I don't how to use that to get a particular record's label.
Just change getName() to getLabel(), if I understood what you need. If not can you be little more specific
Hi Abdul,
Sorry But this expression will give object-Name label. I want the record label.
Object Name -: Topic
Record Id -: xyz
Record Name -: Setup
So I want this Record Name "setup" Label
CharuDutt provided the answer to your query. I think you should try his solution and if it works mark that answer the best
Sorry but that SOQL query is fetching record name. I check it by switching the language the translation of that record name is not coming.
Thanks
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_tolabel.htm
You can use ToLabel in SOQL for that but I guess there are some limitations which field you can use there. Please read the above link, it may help you addressing your issue
Try This Code Please Mark It as Best If It Helps
Thank You!