• Abdul Patel
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 7
    Replies
Hi,

I have server side controller which shows the records are fetched properly in the debug logs however, when this is fetched in the lightning compononent, the component shows blanks records.

 
I am trying to show an edit pop up when someone clicks on the icon shown with aura iteration. Below is my code -

<aura:iteration items="{!v.campaign.Campaign_Members__r}" var="cm">
<tr>
   <td class="slds-text-align_center">
   <div id="{!cm.Id}" class="{!'btn-editStatus cmId-'+cm.Id}" onclick="{!c.handleEdit}">
          <lightning:icon size="x-small" iconName="utility:edit"/>  
   </div>
   </td>
</tr>
</aura:iteration>

How should I get the Id of the record (cm.Id) in the handleEdit function in the lightning controller?
I am doing a POST call to external rest resource. The authorization is 2 step process and I need to pass the JSESSIONID in the second call which is received in first call.

With the POSTMAN, it works fine. Not sure why Apex is giving me 302 as the response status code. Can someone please help what is wrong in my code?

Body-
User-added image
Header - 
User-added image

Below is my code for Http Request -


HttpRequest req1 = new HttpRequest();
String body = 'username=' + username + '&password=' + password + '&_csrf=' + csrf_token;
req1.setEndpoint('https://onlinehearing-backend.cloudapi-dev.sivantos.com/admin/login');
req1.setMethod('POST');
req1.setBody(body);
req1.setHeader('Cookie', sessionIdString); // sessionIdString is sessionId in format -  JSESSIONID=69C4096F47BB59594D5D6C45A20A166C
//req1.setHeader('Authorization',  'Bearer '+sessionId);

Http http1 = new Http();
HTTPResponse resp = http1.send(req1);
System.debug('resp>>' + resp);
Hi,

I have server side controller which shows the records are fetched properly in the debug logs however, when this is fetched in the lightning compononent, the component shows blanks records.

 
I am trying to show an edit pop up when someone clicks on the icon shown with aura iteration. Below is my code -

<aura:iteration items="{!v.campaign.Campaign_Members__r}" var="cm">
<tr>
   <td class="slds-text-align_center">
   <div id="{!cm.Id}" class="{!'btn-editStatus cmId-'+cm.Id}" onclick="{!c.handleEdit}">
          <lightning:icon size="x-small" iconName="utility:edit"/>  
   </div>
   </td>
</tr>
</aura:iteration>

How should I get the Id of the record (cm.Id) in the handleEdit function in the lightning controller?
I am doing a POST call to external rest resource. The authorization is 2 step process and I need to pass the JSESSIONID in the second call which is received in first call.

With the POSTMAN, it works fine. Not sure why Apex is giving me 302 as the response status code. Can someone please help what is wrong in my code?

Body-
User-added image
Header - 
User-added image

Below is my code for Http Request -


HttpRequest req1 = new HttpRequest();
String body = 'username=' + username + '&password=' + password + '&_csrf=' + csrf_token;
req1.setEndpoint('https://onlinehearing-backend.cloudapi-dev.sivantos.com/admin/login');
req1.setMethod('POST');
req1.setBody(body);
req1.setHeader('Cookie', sessionIdString); // sessionIdString is sessionId in format -  JSESSIONID=69C4096F47BB59594D5D6C45A20A166C
//req1.setHeader('Authorization',  'Bearer '+sessionId);

Http http1 = new Http();
HTTPResponse resp = http1.send(req1);
System.debug('resp>>' + resp);