LWC and complex parametersHow do I pass a SObject record from LWC to a custom Apex method to persist data?Apex Prepopulated Email bodyNeed help writing test Apex ClasseHow to pass a variable's value of child visualforce page to a variable in parent visualforce using jsI am getting Exception FATAL_ERROR|System. LimitException: Maximum stack depth reached: 12Not able to escape quote in visualforce page?fault string: No such parameter param defined for the operation, please check the WSDL for the servicewhat is wrong in this codeNeed to add field in apex class email template - not workingWhy is my Approval Process instance not creating NewWorkItems?Is there any help/ hint while attending trailhead challenge?

How did Arya get back her dagger from Sansa?

My ID is expired, can I fly to the Bahamas with my passport?

Mathematica "deeper" documentation

Power LED from 3.3V Power Pin without Resistor

Is it legal to define an unnamed struct?

Accidentally deleted the "/usr/share" folder

How can I close a gap between my fence and my neighbor's that's on his side of the property line?

CRT Oscilloscope - part of the plot is missing

Any examples of headwear for races with animal ears?

Attending a conference where my ex-supervisor and his collaborator are present, should I attend?

How to back up a running Linode server?

What was the state of the German rail system in 1944?

Does hiding behind 5-ft-wide cover give full cover?

What precisely is a link?

Is NMDA produced in the body?

Showing the sample mean is a sufficient statistics from an exponential distribution

If Melisandre foresaw another character closing blue eyes, why did she follow Stannis?

How do I tell my manager that his code review comment is wrong?

Why is Thanos so tough at the beginning of "Avengers: Endgame"?

Selecting a secure PIN for building access

How did Arya manage to disguise herself?

Is Cola "probably the best-known" Latin word in the world? If not, which might it be?

Why is the SNP putting so much emphasis on currency plans?

Is Jon Snow immune to dragonfire?



LWC and complex parameters


How do I pass a SObject record from LWC to a custom Apex method to persist data?Apex Prepopulated Email bodyNeed help writing test Apex ClasseHow to pass a variable's value of child visualforce page to a variable in parent visualforce using jsI am getting Exception FATAL_ERROR|System. LimitException: Maximum stack depth reached: 12Not able to escape quote in visualforce page?fault string: No such parameter param defined for the operation, please check the WSDL for the servicewhat is wrong in this codeNeed to add field in apex class email template - not workingWhy is my Approval Process instance not creating NewWorkItems?Is there any help/ hint while attending trailhead challenge?






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








3















I am trying to pass a list of objects to Apex from an LWC controller, and it looks like the Apex controller is getting the right sized list, but nothing is populated. Does anybody have any idea of what could be the problem?



Component JS code



refreshPeople() 
let xxx = [];

xxx.push(name : 'aaa', email : 'bbb');
xxx.push(name : '111', email : '222');

getPeople(peopleInfo: xxx)
.then(result =>
console.log('#### HERE');
this.allPeople2 = result;
)
.catch(error =>
//Error Handling goes here
);



Apex:



@AuraEnabled(cacheable = true)
public static List<EmailPerson> getPeople(List<EmailPerson> peopleInfo)
try

System.debug('####' + peopleInfo);

return null;
catch (Exception e)
throw new AuraHandledException(e.getMessage() + ' ' + e.getStackTraceString());



public class EmailPerson
@AuraEnabled
public Id id;
@AuraEnabled
public String name;
@AuraEnabled
public String email;
@AuraEnabled
public Id recordTypeId;
@AuraEnabled
public String recordTypeName;



Note: I've tried @wire, the behavior is the same. The list sees the two items, but none the values on the properties are assigned




<17:00:38:006 USER_DEBUG [20]|DEBUG|####(EmailPerson:[email=null, name=null], EmailPerson:[email=null, name=null])











share|improve this question




























    3















    I am trying to pass a list of objects to Apex from an LWC controller, and it looks like the Apex controller is getting the right sized list, but nothing is populated. Does anybody have any idea of what could be the problem?



    Component JS code



    refreshPeople() 
    let xxx = [];

    xxx.push(name : 'aaa', email : 'bbb');
    xxx.push(name : '111', email : '222');

    getPeople(peopleInfo: xxx)
    .then(result =>
    console.log('#### HERE');
    this.allPeople2 = result;
    )
    .catch(error =>
    //Error Handling goes here
    );



    Apex:



    @AuraEnabled(cacheable = true)
    public static List<EmailPerson> getPeople(List<EmailPerson> peopleInfo)
    try

    System.debug('####' + peopleInfo);

    return null;
    catch (Exception e)
    throw new AuraHandledException(e.getMessage() + ' ' + e.getStackTraceString());



    public class EmailPerson
    @AuraEnabled
    public Id id;
    @AuraEnabled
    public String name;
    @AuraEnabled
    public String email;
    @AuraEnabled
    public Id recordTypeId;
    @AuraEnabled
    public String recordTypeName;



    Note: I've tried @wire, the behavior is the same. The list sees the two items, but none the values on the properties are assigned




    <17:00:38:006 USER_DEBUG [20]|DEBUG|####(EmailPerson:[email=null, name=null], EmailPerson:[email=null, name=null])











    share|improve this question
























      3












      3








      3








      I am trying to pass a list of objects to Apex from an LWC controller, and it looks like the Apex controller is getting the right sized list, but nothing is populated. Does anybody have any idea of what could be the problem?



      Component JS code



      refreshPeople() 
      let xxx = [];

      xxx.push(name : 'aaa', email : 'bbb');
      xxx.push(name : '111', email : '222');

      getPeople(peopleInfo: xxx)
      .then(result =>
      console.log('#### HERE');
      this.allPeople2 = result;
      )
      .catch(error =>
      //Error Handling goes here
      );



      Apex:



      @AuraEnabled(cacheable = true)
      public static List<EmailPerson> getPeople(List<EmailPerson> peopleInfo)
      try

      System.debug('####' + peopleInfo);

      return null;
      catch (Exception e)
      throw new AuraHandledException(e.getMessage() + ' ' + e.getStackTraceString());



      public class EmailPerson
      @AuraEnabled
      public Id id;
      @AuraEnabled
      public String name;
      @AuraEnabled
      public String email;
      @AuraEnabled
      public Id recordTypeId;
      @AuraEnabled
      public String recordTypeName;



      Note: I've tried @wire, the behavior is the same. The list sees the two items, but none the values on the properties are assigned




      <17:00:38:006 USER_DEBUG [20]|DEBUG|####(EmailPerson:[email=null, name=null], EmailPerson:[email=null, name=null])











      share|improve this question














      I am trying to pass a list of objects to Apex from an LWC controller, and it looks like the Apex controller is getting the right sized list, but nothing is populated. Does anybody have any idea of what could be the problem?



      Component JS code



      refreshPeople() 
      let xxx = [];

      xxx.push(name : 'aaa', email : 'bbb');
      xxx.push(name : '111', email : '222');

      getPeople(peopleInfo: xxx)
      .then(result =>
      console.log('#### HERE');
      this.allPeople2 = result;
      )
      .catch(error =>
      //Error Handling goes here
      );



      Apex:



      @AuraEnabled(cacheable = true)
      public static List<EmailPerson> getPeople(List<EmailPerson> peopleInfo)
      try

      System.debug('####' + peopleInfo);

      return null;
      catch (Exception e)
      throw new AuraHandledException(e.getMessage() + ' ' + e.getStackTraceString());



      public class EmailPerson
      @AuraEnabled
      public Id id;
      @AuraEnabled
      public String name;
      @AuraEnabled
      public String email;
      @AuraEnabled
      public Id recordTypeId;
      @AuraEnabled
      public String recordTypeName;



      Note: I've tried @wire, the behavior is the same. The list sees the two items, but none the values on the properties are assigned




      <17:00:38:006 USER_DEBUG [20]|DEBUG|####(EmailPerson:[email=null, name=null], EmailPerson:[email=null, name=null])








      apex lightning-web-components






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 9 at 0:05









      Sebastian KesselSebastian Kessel

      9,17362239




      9,17362239




















          1 Answer
          1






          active

          oldest

          votes


















          4














          After 2 hours of struggling, and only 5 minutes after posting, here is the answer:



          You have to add add get;set; explicitly for this to work. Changing my inner class to the below fixed the problem.



          public class EmailPerson 
          @AuraEnabled
          public Id id get;set;
          @AuraEnabled
          public String name get;set;
          @AuraEnabled
          public String email get;set;
          @AuraEnabled
          public Id recordTypeId get;set;
          @AuraEnabled
          public String recordTypeName get;set;






          share|improve this answer


















          • 3





            Its so weird that they expect this and just @auraEnabled is not sufficient .Will be curious for explanation from SFDC LWC Product team why do we need get and set on properties .

            – Mohith Shrivastava
            Apr 9 at 0:26






          • 1





            I’d love to hear it as well. That’s 2 hours of the clients time down the drain.

            – Sebastian Kessel
            Apr 9 at 0:27











          • This is exactly why I avoid wrappers and use the Map<String, Object> datatypes.

            – tsalb
            Apr 9 at 2:41











          • FYI, I made an answer here about dealing with complex datatypes without wrappers.

            – tsalb
            Apr 9 at 5:49












          • I used the Map approach a lot with aura, but for things as simple as what I needed I should’ve been able to just pass an object. Making me be explicit with getter and setters is counter intuitive

            – Sebastian Kessel
            Apr 9 at 16:01











          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%2f257074%2flwc-and-complex-parameters%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4














          After 2 hours of struggling, and only 5 minutes after posting, here is the answer:



          You have to add add get;set; explicitly for this to work. Changing my inner class to the below fixed the problem.



          public class EmailPerson 
          @AuraEnabled
          public Id id get;set;
          @AuraEnabled
          public String name get;set;
          @AuraEnabled
          public String email get;set;
          @AuraEnabled
          public Id recordTypeId get;set;
          @AuraEnabled
          public String recordTypeName get;set;






          share|improve this answer


















          • 3





            Its so weird that they expect this and just @auraEnabled is not sufficient .Will be curious for explanation from SFDC LWC Product team why do we need get and set on properties .

            – Mohith Shrivastava
            Apr 9 at 0:26






          • 1





            I’d love to hear it as well. That’s 2 hours of the clients time down the drain.

            – Sebastian Kessel
            Apr 9 at 0:27











          • This is exactly why I avoid wrappers and use the Map<String, Object> datatypes.

            – tsalb
            Apr 9 at 2:41











          • FYI, I made an answer here about dealing with complex datatypes without wrappers.

            – tsalb
            Apr 9 at 5:49












          • I used the Map approach a lot with aura, but for things as simple as what I needed I should’ve been able to just pass an object. Making me be explicit with getter and setters is counter intuitive

            – Sebastian Kessel
            Apr 9 at 16:01















          4














          After 2 hours of struggling, and only 5 minutes after posting, here is the answer:



          You have to add add get;set; explicitly for this to work. Changing my inner class to the below fixed the problem.



          public class EmailPerson 
          @AuraEnabled
          public Id id get;set;
          @AuraEnabled
          public String name get;set;
          @AuraEnabled
          public String email get;set;
          @AuraEnabled
          public Id recordTypeId get;set;
          @AuraEnabled
          public String recordTypeName get;set;






          share|improve this answer


















          • 3





            Its so weird that they expect this and just @auraEnabled is not sufficient .Will be curious for explanation from SFDC LWC Product team why do we need get and set on properties .

            – Mohith Shrivastava
            Apr 9 at 0:26






          • 1





            I’d love to hear it as well. That’s 2 hours of the clients time down the drain.

            – Sebastian Kessel
            Apr 9 at 0:27











          • This is exactly why I avoid wrappers and use the Map<String, Object> datatypes.

            – tsalb
            Apr 9 at 2:41











          • FYI, I made an answer here about dealing with complex datatypes without wrappers.

            – tsalb
            Apr 9 at 5:49












          • I used the Map approach a lot with aura, but for things as simple as what I needed I should’ve been able to just pass an object. Making me be explicit with getter and setters is counter intuitive

            – Sebastian Kessel
            Apr 9 at 16:01













          4












          4








          4







          After 2 hours of struggling, and only 5 minutes after posting, here is the answer:



          You have to add add get;set; explicitly for this to work. Changing my inner class to the below fixed the problem.



          public class EmailPerson 
          @AuraEnabled
          public Id id get;set;
          @AuraEnabled
          public String name get;set;
          @AuraEnabled
          public String email get;set;
          @AuraEnabled
          public Id recordTypeId get;set;
          @AuraEnabled
          public String recordTypeName get;set;






          share|improve this answer













          After 2 hours of struggling, and only 5 minutes after posting, here is the answer:



          You have to add add get;set; explicitly for this to work. Changing my inner class to the below fixed the problem.



          public class EmailPerson 
          @AuraEnabled
          public Id id get;set;
          @AuraEnabled
          public String name get;set;
          @AuraEnabled
          public String email get;set;
          @AuraEnabled
          public Id recordTypeId get;set;
          @AuraEnabled
          public String recordTypeName get;set;







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 9 at 0:11









          Sebastian KesselSebastian Kessel

          9,17362239




          9,17362239







          • 3





            Its so weird that they expect this and just @auraEnabled is not sufficient .Will be curious for explanation from SFDC LWC Product team why do we need get and set on properties .

            – Mohith Shrivastava
            Apr 9 at 0:26






          • 1





            I’d love to hear it as well. That’s 2 hours of the clients time down the drain.

            – Sebastian Kessel
            Apr 9 at 0:27











          • This is exactly why I avoid wrappers and use the Map<String, Object> datatypes.

            – tsalb
            Apr 9 at 2:41











          • FYI, I made an answer here about dealing with complex datatypes without wrappers.

            – tsalb
            Apr 9 at 5:49












          • I used the Map approach a lot with aura, but for things as simple as what I needed I should’ve been able to just pass an object. Making me be explicit with getter and setters is counter intuitive

            – Sebastian Kessel
            Apr 9 at 16:01












          • 3





            Its so weird that they expect this and just @auraEnabled is not sufficient .Will be curious for explanation from SFDC LWC Product team why do we need get and set on properties .

            – Mohith Shrivastava
            Apr 9 at 0:26






          • 1





            I’d love to hear it as well. That’s 2 hours of the clients time down the drain.

            – Sebastian Kessel
            Apr 9 at 0:27











          • This is exactly why I avoid wrappers and use the Map<String, Object> datatypes.

            – tsalb
            Apr 9 at 2:41











          • FYI, I made an answer here about dealing with complex datatypes without wrappers.

            – tsalb
            Apr 9 at 5:49












          • I used the Map approach a lot with aura, but for things as simple as what I needed I should’ve been able to just pass an object. Making me be explicit with getter and setters is counter intuitive

            – Sebastian Kessel
            Apr 9 at 16:01







          3




          3





          Its so weird that they expect this and just @auraEnabled is not sufficient .Will be curious for explanation from SFDC LWC Product team why do we need get and set on properties .

          – Mohith Shrivastava
          Apr 9 at 0:26





          Its so weird that they expect this and just @auraEnabled is not sufficient .Will be curious for explanation from SFDC LWC Product team why do we need get and set on properties .

          – Mohith Shrivastava
          Apr 9 at 0:26




          1




          1





          I’d love to hear it as well. That’s 2 hours of the clients time down the drain.

          – Sebastian Kessel
          Apr 9 at 0:27





          I’d love to hear it as well. That’s 2 hours of the clients time down the drain.

          – Sebastian Kessel
          Apr 9 at 0:27













          This is exactly why I avoid wrappers and use the Map<String, Object> datatypes.

          – tsalb
          Apr 9 at 2:41





          This is exactly why I avoid wrappers and use the Map<String, Object> datatypes.

          – tsalb
          Apr 9 at 2:41













          FYI, I made an answer here about dealing with complex datatypes without wrappers.

          – tsalb
          Apr 9 at 5:49






          FYI, I made an answer here about dealing with complex datatypes without wrappers.

          – tsalb
          Apr 9 at 5:49














          I used the Map approach a lot with aura, but for things as simple as what I needed I should’ve been able to just pass an object. Making me be explicit with getter and setters is counter intuitive

          – Sebastian Kessel
          Apr 9 at 16:01





          I used the Map approach a lot with aura, but for things as simple as what I needed I should’ve been able to just pass an object. Making me be explicit with getter and setters is counter intuitive

          – Sebastian Kessel
          Apr 9 at 16:01

















          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%2f257074%2flwc-and-complex-parameters%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

          Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

          Tähtien Talli Jäsenet | Lähteet | NavigointivalikkoSuomen Hippos – Tähtien Talli

          Do these cracks on my tires look bad? The Next CEO of Stack OverflowDry rot tire should I replace?Having to replace tiresFishtailed so easily? Bad tires? ABS?Filling the tires with something other than air, to avoid puncture hassles?Used Michelin tires safe to install?Do these tyre cracks necessitate replacement?Rumbling noise: tires or mechanicalIs it possible to fix noisy feathered tires?Are bad winter tires still better than summer tires in winter?Torque converter failure - Related to replacing only 2 tires?Why use snow tires on all 4 wheels on 2-wheel-drive cars?