Variable is not visibleOpportunity Record Type Selection Pageneed a method for json string which contains...

Would a National Army of mercenaries be a feasible idea?

A starship is travelling at 0.9c and collides with a small rock. Will it leave a clean hole through, or will more happen?

Is it a fallacy if someone claims they need an explanation for every word of your argument to the point where they don't understand common terms?

What to do when being responsible for data protection in your lab, yet advice is ignored?

What makes the Forgotten Realms "forgotten"?

Why is working on the same position for more than 15 years not a red flag?

What creature do these Alchemical Humonculus actions target?

Slow moving projectiles from a hand-held weapon - how do they reach the target?

Dilemma of explaining to interviewer that he is the reason for declining second interview

What was the earliest start time of a Catholic mass before 1957?

What kind of hardware implements Fourier transform?

Magento 2 : Call Helper Without Using __construct in Own Module

Typing Amharic inside a math equation?

How do you funnel food off a cutting board?

Do authors have to be politically correct in article-writing?

Word or phrase for showing great skill at something without formal training in it

Can you earn endless XP using a Flameskull and its self-revival feature?

Citing paywalled articles accessed via illegal web sharing

Does fast page mode apply to ROM?

Is there some relative to Dutch word "kijken" in German?

Eww, those bytes are gross

Book where aliens are selecting humans for food consumption

Why would the Pakistan airspace closure cancel flights not headed to Pakistan itself?

How to acknowledge an embarrassing job interview, now that I work directly with the interviewer?



Variable is not visible


Opportunity Record Type Selection Pageneed a method for json string which contains null value and does not contain attributes{ }Apex Trigger: Variable does not existApex REST API to return a Map of Maps?“Variable not visible” error in production, but fine in developmentgetContentAsPDF returning Internal Salesforce.com Error when called from a webserviceField visible to true using apex classSalesforce No_Oauth_State, State not validPost request returns error 405 on ngrokVariable not visible













1















I have this variable which returns key from custom settings. below is the code related to this



  private static String AccLinks {
get {

if (Acclinks == null) {
Key_Value_List__c kvl = Key_Value_List__c.getInstance('Acc_Content');
AccLinks = (kvl != null && kvl.Value__c != null ? kvl.Value__c : 'some_url');
}
return AccLinks;
}
}


when I run this code, I am getting this error




Variable is not visible: Acc_Class2.Acclinks




Can anyone help me with this










share|improve this question



























    1















    I have this variable which returns key from custom settings. below is the code related to this



      private static String AccLinks {
    get {

    if (Acclinks == null) {
    Key_Value_List__c kvl = Key_Value_List__c.getInstance('Acc_Content');
    AccLinks = (kvl != null && kvl.Value__c != null ? kvl.Value__c : 'some_url');
    }
    return AccLinks;
    }
    }


    when I run this code, I am getting this error




    Variable is not visible: Acc_Class2.Acclinks




    Can anyone help me with this










    share|improve this question

























      1












      1








      1








      I have this variable which returns key from custom settings. below is the code related to this



        private static String AccLinks {
      get {

      if (Acclinks == null) {
      Key_Value_List__c kvl = Key_Value_List__c.getInstance('Acc_Content');
      AccLinks = (kvl != null && kvl.Value__c != null ? kvl.Value__c : 'some_url');
      }
      return AccLinks;
      }
      }


      when I run this code, I am getting this error




      Variable is not visible: Acc_Class2.Acclinks




      Can anyone help me with this










      share|improve this question














      I have this variable which returns key from custom settings. below is the code related to this



        private static String AccLinks {
      get {

      if (Acclinks == null) {
      Key_Value_List__c kvl = Key_Value_List__c.getInstance('Acc_Content');
      AccLinks = (kvl != null && kvl.Value__c != null ? kvl.Value__c : 'some_url');
      }
      return AccLinks;
      }
      }


      when I run this code, I am getting this error




      Variable is not visible: Acc_Class2.Acclinks




      Can anyone help me with this







      apex rest-api apexrest controller-extension custom-controller






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 days ago









      S kanthS kanth

      255




      255






















          2 Answers
          2






          active

          oldest

          votes


















          5














          You cannot assign to a property



          AccLinks = (kvl != null && kvl.Value__c != null ? kvl.Value__c : 'some_url');


          if that property does not have a setter method declared. To make the property read-only while caching its value (a lazy-loading pattern), you can synthesize a private setter:



          get {
          // ...
          }
          private set;


          That will allow your class itself to set the value. See Apex Properties for more.






          share|improve this answer































            1














            As mentioned, you cannot set the value to your property when you don't have a setter defined.



            In your case, you can instead use the below code where you won't be able to set the value for your variable, but you will always get the value from your custom setting record.



            private static String AccLinks { 
            get {
            string returnValue = 'some_url'; //you can keep any default value
            if (Acclinks == null) {
            Key_Value_List__c kvl = Key_Value_List__c.getInstance('Acc_Content');
            returnValue = (kvl != null && kvl.Value__c != null ? kvl.Value__c : 'some_url');
            }
            return returnValue;
            }
            }


            Another option would be to have a private setter using which you can set the value to your variable



            private static String AccLinks {
            get {
            if (Acclinks == null) {
            Key_Value_List__c kvl = Key_Value_List__c.getInstance('Acc_Content');
            AccLinks = (kvl != null && kvl.Value__c != null ? kvl.Value__c : 'some_url');
            }
            return AccLinks;
            } private set;
            }





            share|improve this answer

























              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',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              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%2f251915%2fvariable-is-not-visible%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              5














              You cannot assign to a property



              AccLinks = (kvl != null && kvl.Value__c != null ? kvl.Value__c : 'some_url');


              if that property does not have a setter method declared. To make the property read-only while caching its value (a lazy-loading pattern), you can synthesize a private setter:



              get {
              // ...
              }
              private set;


              That will allow your class itself to set the value. See Apex Properties for more.






              share|improve this answer




























                5














                You cannot assign to a property



                AccLinks = (kvl != null && kvl.Value__c != null ? kvl.Value__c : 'some_url');


                if that property does not have a setter method declared. To make the property read-only while caching its value (a lazy-loading pattern), you can synthesize a private setter:



                get {
                // ...
                }
                private set;


                That will allow your class itself to set the value. See Apex Properties for more.






                share|improve this answer


























                  5












                  5








                  5







                  You cannot assign to a property



                  AccLinks = (kvl != null && kvl.Value__c != null ? kvl.Value__c : 'some_url');


                  if that property does not have a setter method declared. To make the property read-only while caching its value (a lazy-loading pattern), you can synthesize a private setter:



                  get {
                  // ...
                  }
                  private set;


                  That will allow your class itself to set the value. See Apex Properties for more.






                  share|improve this answer













                  You cannot assign to a property



                  AccLinks = (kvl != null && kvl.Value__c != null ? kvl.Value__c : 'some_url');


                  if that property does not have a setter method declared. To make the property read-only while caching its value (a lazy-loading pattern), you can synthesize a private setter:



                  get {
                  // ...
                  }
                  private set;


                  That will allow your class itself to set the value. See Apex Properties for more.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 2 days ago









                  David ReedDavid Reed

                  36.1k72154




                  36.1k72154

























                      1














                      As mentioned, you cannot set the value to your property when you don't have a setter defined.



                      In your case, you can instead use the below code where you won't be able to set the value for your variable, but you will always get the value from your custom setting record.



                      private static String AccLinks { 
                      get {
                      string returnValue = 'some_url'; //you can keep any default value
                      if (Acclinks == null) {
                      Key_Value_List__c kvl = Key_Value_List__c.getInstance('Acc_Content');
                      returnValue = (kvl != null && kvl.Value__c != null ? kvl.Value__c : 'some_url');
                      }
                      return returnValue;
                      }
                      }


                      Another option would be to have a private setter using which you can set the value to your variable



                      private static String AccLinks {
                      get {
                      if (Acclinks == null) {
                      Key_Value_List__c kvl = Key_Value_List__c.getInstance('Acc_Content');
                      AccLinks = (kvl != null && kvl.Value__c != null ? kvl.Value__c : 'some_url');
                      }
                      return AccLinks;
                      } private set;
                      }





                      share|improve this answer






























                        1














                        As mentioned, you cannot set the value to your property when you don't have a setter defined.



                        In your case, you can instead use the below code where you won't be able to set the value for your variable, but you will always get the value from your custom setting record.



                        private static String AccLinks { 
                        get {
                        string returnValue = 'some_url'; //you can keep any default value
                        if (Acclinks == null) {
                        Key_Value_List__c kvl = Key_Value_List__c.getInstance('Acc_Content');
                        returnValue = (kvl != null && kvl.Value__c != null ? kvl.Value__c : 'some_url');
                        }
                        return returnValue;
                        }
                        }


                        Another option would be to have a private setter using which you can set the value to your variable



                        private static String AccLinks {
                        get {
                        if (Acclinks == null) {
                        Key_Value_List__c kvl = Key_Value_List__c.getInstance('Acc_Content');
                        AccLinks = (kvl != null && kvl.Value__c != null ? kvl.Value__c : 'some_url');
                        }
                        return AccLinks;
                        } private set;
                        }





                        share|improve this answer




























                          1












                          1








                          1







                          As mentioned, you cannot set the value to your property when you don't have a setter defined.



                          In your case, you can instead use the below code where you won't be able to set the value for your variable, but you will always get the value from your custom setting record.



                          private static String AccLinks { 
                          get {
                          string returnValue = 'some_url'; //you can keep any default value
                          if (Acclinks == null) {
                          Key_Value_List__c kvl = Key_Value_List__c.getInstance('Acc_Content');
                          returnValue = (kvl != null && kvl.Value__c != null ? kvl.Value__c : 'some_url');
                          }
                          return returnValue;
                          }
                          }


                          Another option would be to have a private setter using which you can set the value to your variable



                          private static String AccLinks {
                          get {
                          if (Acclinks == null) {
                          Key_Value_List__c kvl = Key_Value_List__c.getInstance('Acc_Content');
                          AccLinks = (kvl != null && kvl.Value__c != null ? kvl.Value__c : 'some_url');
                          }
                          return AccLinks;
                          } private set;
                          }





                          share|improve this answer















                          As mentioned, you cannot set the value to your property when you don't have a setter defined.



                          In your case, you can instead use the below code where you won't be able to set the value for your variable, but you will always get the value from your custom setting record.



                          private static String AccLinks { 
                          get {
                          string returnValue = 'some_url'; //you can keep any default value
                          if (Acclinks == null) {
                          Key_Value_List__c kvl = Key_Value_List__c.getInstance('Acc_Content');
                          returnValue = (kvl != null && kvl.Value__c != null ? kvl.Value__c : 'some_url');
                          }
                          return returnValue;
                          }
                          }


                          Another option would be to have a private setter using which you can set the value to your variable



                          private static String AccLinks {
                          get {
                          if (Acclinks == null) {
                          Key_Value_List__c kvl = Key_Value_List__c.getInstance('Acc_Content');
                          AccLinks = (kvl != null && kvl.Value__c != null ? kvl.Value__c : 'some_url');
                          }
                          return AccLinks;
                          } private set;
                          }






                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited yesterday

























                          answered 2 days ago









                          Vijay GanjiVijay Ganji

                          844211




                          844211






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Salesforce Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f251915%2fvariable-is-not-visible%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Webac Holding Inhaltsverzeichnis Geschichte | Organisationsstruktur | Tochterfirmen |...

                              What's the meaning of a knight fighting a snail in medieval book illustrations?What is the meaning of a glove...

                              Salamanca Inhaltsverzeichnis Lage und Klima | Bevölkerungsentwicklung | Geschichte | Kultur und...