Protected custom settings as a parameter in an @AuraEnabled method causes errorProtected Custom Settings in managed package are not visible by apex classUsing site.getName() with custom settings method getInstance()Data in custom protected settings and its visibilityIs encrypting passwords in protected custom settings a security requirement?Custom settings field errorCustom Settings - Visibility Protected - Managed PackageCan protected custom settings be edited by the API?Parameter In AuraEnabled Method Is NullEditing protected custom settings in subscriber orgCan protected custom settings records be retrieved via SOQL Query?

Why does capacitance not depend on the material of the plates?

Pronouns when writing from the point of view of a robot

Variable doesn't parse as string

Can I enter a rental property without giving notice if I'm afraid a tenant may be hurt?

Are the related objects in an SOQL query shared?

Probably terminated or laid off soon; confront or not?

Why are there yellow dot stickers on the front doors of businesses in Russia?

Write The Shortest Program to Calculate Height of a Binary Tree

Why do proponents of guns oppose gun competency tests?

What's "halachic" about "Esav hates Ya'akov"?

Broken bottom bracket?

“The Fourier transform cannot measure two phases at the same frequency.” Why not?

Why did the US Airways Flight 1549 passengers stay on the wings?

When using the Proficiency Dice optional rule, how should they be used in determining a character's Spell Save DC?

Properties: Left of the colon

Vectorised way to calculate mean of left and right neighbours in a vector

Write The Shortest Program To Check If A Binary Tree Is Balanced

What printing process is this?

Plotting Autoregressive Functions / Linear Difference Equations

Can I use my US callsign to transmit while in El Salvador?

Is there a way to improve my grade after graduation?

I was contacted by a private bank overseas to get my inheritance

What could prevent players from leaving an island?

How do the surviving Asgardians get to Earth?



Protected custom settings as a parameter in an @AuraEnabled method causes error


Protected Custom Settings in managed package are not visible by apex classUsing site.getName() with custom settings method getInstance()Data in custom protected settings and its visibilityIs encrypting passwords in protected custom settings a security requirement?Custom settings field errorCustom Settings - Visibility Protected - Managed PackageCan protected custom settings be edited by the API?Parameter In AuraEnabled Method Is NullEditing protected custom settings in subscriber orgCan protected custom settings records be retrieved via SOQL Query?






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








3















Given



Apex controller



@AuraEnabled
public static String saveAppSetting(AppSetting__c config)

if (config == null)
throw new AuraHandledException(System.Label.NO_DATA);


// skipped for brevity
return 'success';



Aura component helper



saveAppSetting: function(component) 
const action = component.get("c.saveAppSetting");
action.setParam("config", null);
action.setCallback(this, function(response)
const state = response.getState();
if (state === "SUCCESS")
console.log("Success");
else
console.error("Error");

);

$A.enqueueAction(action);



When I execute this in a scratch org with a namespace, everything is fine. When this code runs in a subscriber org inside an installed managed packed, this ends up with the following error:



enter image description here



It doesn't get to this if (config == null) line on server, so it must break during deserialization and this is out of developer reach. Has anyone had such issues and does anybody know how to address it?










share|improve this question






























    3















    Given



    Apex controller



    @AuraEnabled
    public static String saveAppSetting(AppSetting__c config)

    if (config == null)
    throw new AuraHandledException(System.Label.NO_DATA);


    // skipped for brevity
    return 'success';



    Aura component helper



    saveAppSetting: function(component) 
    const action = component.get("c.saveAppSetting");
    action.setParam("config", null);
    action.setCallback(this, function(response)
    const state = response.getState();
    if (state === "SUCCESS")
    console.log("Success");
    else
    console.error("Error");

    );

    $A.enqueueAction(action);



    When I execute this in a scratch org with a namespace, everything is fine. When this code runs in a subscriber org inside an installed managed packed, this ends up with the following error:



    enter image description here



    It doesn't get to this if (config == null) line on server, so it must break during deserialization and this is out of developer reach. Has anyone had such issues and does anybody know how to address it?










    share|improve this question


























      3












      3








      3








      Given



      Apex controller



      @AuraEnabled
      public static String saveAppSetting(AppSetting__c config)

      if (config == null)
      throw new AuraHandledException(System.Label.NO_DATA);


      // skipped for brevity
      return 'success';



      Aura component helper



      saveAppSetting: function(component) 
      const action = component.get("c.saveAppSetting");
      action.setParam("config", null);
      action.setCallback(this, function(response)
      const state = response.getState();
      if (state === "SUCCESS")
      console.log("Success");
      else
      console.error("Error");

      );

      $A.enqueueAction(action);



      When I execute this in a scratch org with a namespace, everything is fine. When this code runs in a subscriber org inside an installed managed packed, this ends up with the following error:



      enter image description here



      It doesn't get to this if (config == null) line on server, so it must break during deserialization and this is out of developer reach. Has anyone had such issues and does anybody know how to address it?










      share|improve this question














      Given



      Apex controller



      @AuraEnabled
      public static String saveAppSetting(AppSetting__c config)

      if (config == null)
      throw new AuraHandledException(System.Label.NO_DATA);


      // skipped for brevity
      return 'success';



      Aura component helper



      saveAppSetting: function(component) 
      const action = component.get("c.saveAppSetting");
      action.setParam("config", null);
      action.setCallback(this, function(response)
      const state = response.getState();
      if (state === "SUCCESS")
      console.log("Success");
      else
      console.error("Error");

      );

      $A.enqueueAction(action);



      When I execute this in a scratch org with a namespace, everything is fine. When this code runs in a subscriber org inside an installed managed packed, this ends up with the following error:



      enter image description here



      It doesn't get to this if (config == null) line on server, so it must break during deserialization and this is out of developer reach. Has anyone had such issues and does anybody know how to address it?







      apex managed-package






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jul 25 at 14:15









      EduardEduard

      2,2632 gold badges8 silver badges29 bronze badges




      2,2632 gold badges8 silver badges29 bronze badges























          2 Answers
          2






          active

          oldest

          votes


















          4














          The standard workaround for this is to use a normal String parameter instead:



          @AuraEnabled
          public static String saveAppSetting(String configJson)
          AppSetting__c config = (AppSetting__c)
          JSON.deserialize(configJson, AppSetting__c.class);



          action.setParam("configJson", JSON.stringify(null)); // Or an Object



          In the meantime, you might want to report the bug to Support. As far as I can tell, this should work, it's just a glitch in the platform.






          share|improve this answer
































            1














            I think issue might be with namespace of object.



            @AuraEnabled
            public static String saveAppSetting(namespace__AppSetting__c config)


            Try by adding namespace in auraenabled parameters. I think fields are passed with namespace but if not Pass fields also with namespace from lightning component.






            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%2f271009%2fprotected-custom-settings-as-a-parameter-in-an-auraenabled-method-causes-error%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









              4














              The standard workaround for this is to use a normal String parameter instead:



              @AuraEnabled
              public static String saveAppSetting(String configJson)
              AppSetting__c config = (AppSetting__c)
              JSON.deserialize(configJson, AppSetting__c.class);



              action.setParam("configJson", JSON.stringify(null)); // Or an Object



              In the meantime, you might want to report the bug to Support. As far as I can tell, this should work, it's just a glitch in the platform.






              share|improve this answer





























                4














                The standard workaround for this is to use a normal String parameter instead:



                @AuraEnabled
                public static String saveAppSetting(String configJson)
                AppSetting__c config = (AppSetting__c)
                JSON.deserialize(configJson, AppSetting__c.class);



                action.setParam("configJson", JSON.stringify(null)); // Or an Object



                In the meantime, you might want to report the bug to Support. As far as I can tell, this should work, it's just a glitch in the platform.






                share|improve this answer



























                  4












                  4








                  4







                  The standard workaround for this is to use a normal String parameter instead:



                  @AuraEnabled
                  public static String saveAppSetting(String configJson)
                  AppSetting__c config = (AppSetting__c)
                  JSON.deserialize(configJson, AppSetting__c.class);



                  action.setParam("configJson", JSON.stringify(null)); // Or an Object



                  In the meantime, you might want to report the bug to Support. As far as I can tell, this should work, it's just a glitch in the platform.






                  share|improve this answer













                  The standard workaround for this is to use a normal String parameter instead:



                  @AuraEnabled
                  public static String saveAppSetting(String configJson)
                  AppSetting__c config = (AppSetting__c)
                  JSON.deserialize(configJson, AppSetting__c.class);



                  action.setParam("configJson", JSON.stringify(null)); // Or an Object



                  In the meantime, you might want to report the bug to Support. As far as I can tell, this should work, it's just a glitch in the platform.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jul 25 at 14:39









                  sfdcfoxsfdcfox

                  281k14 gold badges227 silver badges481 bronze badges




                  281k14 gold badges227 silver badges481 bronze badges


























                      1














                      I think issue might be with namespace of object.



                      @AuraEnabled
                      public static String saveAppSetting(namespace__AppSetting__c config)


                      Try by adding namespace in auraenabled parameters. I think fields are passed with namespace but if not Pass fields also with namespace from lightning component.






                      share|improve this answer





























                        1














                        I think issue might be with namespace of object.



                        @AuraEnabled
                        public static String saveAppSetting(namespace__AppSetting__c config)


                        Try by adding namespace in auraenabled parameters. I think fields are passed with namespace but if not Pass fields also with namespace from lightning component.






                        share|improve this answer



























                          1












                          1








                          1







                          I think issue might be with namespace of object.



                          @AuraEnabled
                          public static String saveAppSetting(namespace__AppSetting__c config)


                          Try by adding namespace in auraenabled parameters. I think fields are passed with namespace but if not Pass fields also with namespace from lightning component.






                          share|improve this answer













                          I think issue might be with namespace of object.



                          @AuraEnabled
                          public static String saveAppSetting(namespace__AppSetting__c config)


                          Try by adding namespace in auraenabled parameters. I think fields are passed with namespace but if not Pass fields also with namespace from lightning component.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jul 25 at 15:38









                          Manjot SinghManjot Singh

                          2,4217 silver badges24 bronze badges




                          2,4217 silver badges24 bronze badges






























                              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%2f271009%2fprotected-custom-settings-as-a-parameter-in-an-auraenabled-method-causes-error%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

                              Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                              Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

                              Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?