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

                              Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

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

                              Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form