+ Start a Discussion
alsinan nazimalsinan nazim 

Updating Custom Labels in Apex

Hi all,
I know we can access Custom Labels in Apex and VF.
But, Can we Update the value of a Custom Label through Apex Controller?

If So, How?

With Thanks.
Alex SelwynAlex Selwyn
No, you cannot update Custom Labels through normal apex controller.

You need metadata api to do that. you can use metadata api in apex here is an excellent article (https://andyinthecloud.com/2013/10/27/introduction-to-calling-the-metadata-api-from-apex/)

SFDC coderSFDC coder
@alsinan nazim: No you cannot do that. If you want to update the values then do it from set up custom labels. Incase you want the value to change dynamically use custom setting and store the values in there and fetch them on certain conditions in Apex