Lightning Equivalent to Dynamically get Field Label

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
1
down vote

favorite












We are a multilingual org and need to be to dynamically translate field labels according to the running user's settings. Using Lightning:InputField is not always an option and we preferably do not want to use custom labels as we already have translations via the translation workbench.



For example to retrieve the label for Contact.FirstName we could use the following in Visualforce:



!$ObjectType.Contact.fields.FirstName.Label









share|improve this question



























    up vote
    1
    down vote

    favorite












    We are a multilingual org and need to be to dynamically translate field labels according to the running user's settings. Using Lightning:InputField is not always an option and we preferably do not want to use custom labels as we already have translations via the translation workbench.



    For example to retrieve the label for Contact.FirstName we could use the following in Visualforce:



    !$ObjectType.Contact.fields.FirstName.Label









    share|improve this question























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      We are a multilingual org and need to be to dynamically translate field labels according to the running user's settings. Using Lightning:InputField is not always an option and we preferably do not want to use custom labels as we already have translations via the translation workbench.



      For example to retrieve the label for Contact.FirstName we could use the following in Visualforce:



      !$ObjectType.Contact.fields.FirstName.Label









      share|improve this question













      We are a multilingual org and need to be to dynamically translate field labels according to the running user's settings. Using Lightning:InputField is not always an option and we preferably do not want to use custom labels as we already have translations via the translation workbench.



      For example to retrieve the label for Contact.FirstName we could use the following in Visualforce:



      !$ObjectType.Contact.fields.FirstName.Label






      lightning-components lightning






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 3 hours ago









      Girbot

      3,51511839




      3,51511839




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          3
          down vote













          As of today you cannot access field labels from a lightning component controller or markup and there is no visualforce equivalent.
          You can access a custom label from markup like that:



          !$Label.c.labelName


          But cannot access a field label.
          There is an idea you can upvote : Access sObject field lables from lightning component



          Reference: Get field label in lightning component



          Alternative Approach: You will have to fetch them from server side using apex.






          share|improve this answer



























            up vote
            1
            down vote













            I was recently working on an internal tool for this at the office. Effectively a declarative "service component" you can bring into your own Lightning Components to specify a bunch of field/object labels that you need to pull dynamically from Apex, with a few additional hooks to ensure that you can respond appropriately to the delay in getting these items loaded.



            I don't think it's ready for sharing with the community yet and I'd need management approval but I could look into making it public at some point. Would there be a great deal of community interest in such a tool?



            At the moment, the tool is capable of returning the following:



            • Object:

              • Label (singular and plural)

              • Key prefix (e.g. 001 for Account)

              • Whether it is accessible / createable / deletable / queryable / updateable for the current user


            • Record Types, indexed by Developer Name

              • Id

              • Name

              • Whether it is active


            • Fields

              • Label

              • Type

              • Whether it is accessible / createable / updateable / nillable


            What other information would you want out of a declarative Lightning solution to dynamic object/field references?






            share|improve this answer




















            • Did something similar. It will be nice to specify a language, and get help text/field description
              – kurunve
              2 hours ago










            • I think this sounds great, +1 for help text.
              – Girbot
              37 mins ago










            • @kurunve Specifying a language would be difficult unfortunately because Apex describe only returns labels for user's current language. However it would at least be useful for multi-language orgs as long as you're not trying to display in another user's language.
              – Charles T
              19 mins ago










            • @Girbot Good idea, help text could be included too.
              – Charles T
              18 mins ago










            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "459"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f236347%2flightning-equivalent-to-dynamically-get-field-label%23new-answer', 'question_page');

            );

            Post as a guest






























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            3
            down vote













            As of today you cannot access field labels from a lightning component controller or markup and there is no visualforce equivalent.
            You can access a custom label from markup like that:



            !$Label.c.labelName


            But cannot access a field label.
            There is an idea you can upvote : Access sObject field lables from lightning component



            Reference: Get field label in lightning component



            Alternative Approach: You will have to fetch them from server side using apex.






            share|improve this answer
























              up vote
              3
              down vote













              As of today you cannot access field labels from a lightning component controller or markup and there is no visualforce equivalent.
              You can access a custom label from markup like that:



              !$Label.c.labelName


              But cannot access a field label.
              There is an idea you can upvote : Access sObject field lables from lightning component



              Reference: Get field label in lightning component



              Alternative Approach: You will have to fetch them from server side using apex.






              share|improve this answer






















                up vote
                3
                down vote










                up vote
                3
                down vote









                As of today you cannot access field labels from a lightning component controller or markup and there is no visualforce equivalent.
                You can access a custom label from markup like that:



                !$Label.c.labelName


                But cannot access a field label.
                There is an idea you can upvote : Access sObject field lables from lightning component



                Reference: Get field label in lightning component



                Alternative Approach: You will have to fetch them from server side using apex.






                share|improve this answer












                As of today you cannot access field labels from a lightning component controller or markup and there is no visualforce equivalent.
                You can access a custom label from markup like that:



                !$Label.c.labelName


                But cannot access a field label.
                There is an idea you can upvote : Access sObject field lables from lightning component



                Reference: Get field label in lightning component



                Alternative Approach: You will have to fetch them from server side using apex.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 3 hours ago









                codeyinthecloud

                1,106216




                1,106216






















                    up vote
                    1
                    down vote













                    I was recently working on an internal tool for this at the office. Effectively a declarative "service component" you can bring into your own Lightning Components to specify a bunch of field/object labels that you need to pull dynamically from Apex, with a few additional hooks to ensure that you can respond appropriately to the delay in getting these items loaded.



                    I don't think it's ready for sharing with the community yet and I'd need management approval but I could look into making it public at some point. Would there be a great deal of community interest in such a tool?



                    At the moment, the tool is capable of returning the following:



                    • Object:

                      • Label (singular and plural)

                      • Key prefix (e.g. 001 for Account)

                      • Whether it is accessible / createable / deletable / queryable / updateable for the current user


                    • Record Types, indexed by Developer Name

                      • Id

                      • Name

                      • Whether it is active


                    • Fields

                      • Label

                      • Type

                      • Whether it is accessible / createable / updateable / nillable


                    What other information would you want out of a declarative Lightning solution to dynamic object/field references?






                    share|improve this answer




















                    • Did something similar. It will be nice to specify a language, and get help text/field description
                      – kurunve
                      2 hours ago










                    • I think this sounds great, +1 for help text.
                      – Girbot
                      37 mins ago










                    • @kurunve Specifying a language would be difficult unfortunately because Apex describe only returns labels for user's current language. However it would at least be useful for multi-language orgs as long as you're not trying to display in another user's language.
                      – Charles T
                      19 mins ago










                    • @Girbot Good idea, help text could be included too.
                      – Charles T
                      18 mins ago














                    up vote
                    1
                    down vote













                    I was recently working on an internal tool for this at the office. Effectively a declarative "service component" you can bring into your own Lightning Components to specify a bunch of field/object labels that you need to pull dynamically from Apex, with a few additional hooks to ensure that you can respond appropriately to the delay in getting these items loaded.



                    I don't think it's ready for sharing with the community yet and I'd need management approval but I could look into making it public at some point. Would there be a great deal of community interest in such a tool?



                    At the moment, the tool is capable of returning the following:



                    • Object:

                      • Label (singular and plural)

                      • Key prefix (e.g. 001 for Account)

                      • Whether it is accessible / createable / deletable / queryable / updateable for the current user


                    • Record Types, indexed by Developer Name

                      • Id

                      • Name

                      • Whether it is active


                    • Fields

                      • Label

                      • Type

                      • Whether it is accessible / createable / updateable / nillable


                    What other information would you want out of a declarative Lightning solution to dynamic object/field references?






                    share|improve this answer




















                    • Did something similar. It will be nice to specify a language, and get help text/field description
                      – kurunve
                      2 hours ago










                    • I think this sounds great, +1 for help text.
                      – Girbot
                      37 mins ago










                    • @kurunve Specifying a language would be difficult unfortunately because Apex describe only returns labels for user's current language. However it would at least be useful for multi-language orgs as long as you're not trying to display in another user's language.
                      – Charles T
                      19 mins ago










                    • @Girbot Good idea, help text could be included too.
                      – Charles T
                      18 mins ago












                    up vote
                    1
                    down vote










                    up vote
                    1
                    down vote









                    I was recently working on an internal tool for this at the office. Effectively a declarative "service component" you can bring into your own Lightning Components to specify a bunch of field/object labels that you need to pull dynamically from Apex, with a few additional hooks to ensure that you can respond appropriately to the delay in getting these items loaded.



                    I don't think it's ready for sharing with the community yet and I'd need management approval but I could look into making it public at some point. Would there be a great deal of community interest in such a tool?



                    At the moment, the tool is capable of returning the following:



                    • Object:

                      • Label (singular and plural)

                      • Key prefix (e.g. 001 for Account)

                      • Whether it is accessible / createable / deletable / queryable / updateable for the current user


                    • Record Types, indexed by Developer Name

                      • Id

                      • Name

                      • Whether it is active


                    • Fields

                      • Label

                      • Type

                      • Whether it is accessible / createable / updateable / nillable


                    What other information would you want out of a declarative Lightning solution to dynamic object/field references?






                    share|improve this answer












                    I was recently working on an internal tool for this at the office. Effectively a declarative "service component" you can bring into your own Lightning Components to specify a bunch of field/object labels that you need to pull dynamically from Apex, with a few additional hooks to ensure that you can respond appropriately to the delay in getting these items loaded.



                    I don't think it's ready for sharing with the community yet and I'd need management approval but I could look into making it public at some point. Would there be a great deal of community interest in such a tool?



                    At the moment, the tool is capable of returning the following:



                    • Object:

                      • Label (singular and plural)

                      • Key prefix (e.g. 001 for Account)

                      • Whether it is accessible / createable / deletable / queryable / updateable for the current user


                    • Record Types, indexed by Developer Name

                      • Id

                      • Name

                      • Whether it is active


                    • Fields

                      • Label

                      • Type

                      • Whether it is accessible / createable / updateable / nillable


                    What other information would you want out of a declarative Lightning solution to dynamic object/field references?







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 2 hours ago









                    Charles T

                    5,6101618




                    5,6101618











                    • Did something similar. It will be nice to specify a language, and get help text/field description
                      – kurunve
                      2 hours ago










                    • I think this sounds great, +1 for help text.
                      – Girbot
                      37 mins ago










                    • @kurunve Specifying a language would be difficult unfortunately because Apex describe only returns labels for user's current language. However it would at least be useful for multi-language orgs as long as you're not trying to display in another user's language.
                      – Charles T
                      19 mins ago










                    • @Girbot Good idea, help text could be included too.
                      – Charles T
                      18 mins ago
















                    • Did something similar. It will be nice to specify a language, and get help text/field description
                      – kurunve
                      2 hours ago










                    • I think this sounds great, +1 for help text.
                      – Girbot
                      37 mins ago










                    • @kurunve Specifying a language would be difficult unfortunately because Apex describe only returns labels for user's current language. However it would at least be useful for multi-language orgs as long as you're not trying to display in another user's language.
                      – Charles T
                      19 mins ago










                    • @Girbot Good idea, help text could be included too.
                      – Charles T
                      18 mins ago















                    Did something similar. It will be nice to specify a language, and get help text/field description
                    – kurunve
                    2 hours ago




                    Did something similar. It will be nice to specify a language, and get help text/field description
                    – kurunve
                    2 hours ago












                    I think this sounds great, +1 for help text.
                    – Girbot
                    37 mins ago




                    I think this sounds great, +1 for help text.
                    – Girbot
                    37 mins ago












                    @kurunve Specifying a language would be difficult unfortunately because Apex describe only returns labels for user's current language. However it would at least be useful for multi-language orgs as long as you're not trying to display in another user's language.
                    – Charles T
                    19 mins ago




                    @kurunve Specifying a language would be difficult unfortunately because Apex describe only returns labels for user's current language. However it would at least be useful for multi-language orgs as long as you're not trying to display in another user's language.
                    – Charles T
                    19 mins ago












                    @Girbot Good idea, help text could be included too.
                    – Charles T
                    18 mins ago




                    @Girbot Good idea, help text could be included too.
                    – Charles T
                    18 mins ago

















                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f236347%2flightning-equivalent-to-dynamically-get-field-label%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Comments

                    Popular posts from this blog

                    Long meetings (6-7 hours a day): Being “babysat” by supervisor

                    Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

                    Confectionery