• lakshmi surendran
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
I need to read ContactID from my below JSON.  I used this code to read the fieldvalue, but returning null. 

StripeJSON = StripeChargeParser.parse(RestContext.request.requestBody.toString());
             if (StripeJSON.type == 'charge.succeeded') {       
                system.debug('ContactId:'+StripeJSON.data
                            );


{
  "id": "evt_3LAK6BBp4qEbkdeL1hyxcg7K",
  "object": "event",
  "data": {
    "object": {
      "id": "ch_3LAK6BBp4qEbkdeL1YeUC11P",
      "object": "charge",
      "amount": 100,
      "amount_captured": 100,
      "amount_refunded": 0,
      "balance_transaction": "txn_3LAK6BBp4qEbkdeL1I0CRyU4",
      "billing_details": {
        "address": {
          "city": null,
          "country": null
        },
        "email": null,
        "name": "LakshmiSuren",
        "phone": null
      },

      "invoice": null,
      "livemode": false,
      "metadata": {
        "ContactID": "0038J000001Q8IpQAK",
        "created_by": "FormAssembly - Stripe - Reference: Form 156 / Conn. 302 / Resp. 92945"
      }
}
}
}
I am getting fieldnames from object and iterating throught it. I need to create record with the values from the fieldname. Can someone help to provide the fieldname dynamically in lightning:input. 


<aura:component controller="ModelTabsController">
    <aura:attribute type="String" name="TabsList"/>
    <aura:attribute name="selTabId" type="String"/>
    
    <aura:attribute name ="RFAId" type="String"/>
    
    <aura:attribute name="newRFA" type="Object"/>
    <aura:attribute name="simpleNewRFA" type="Object"/>
    <aura:attribute name="newRFAError" type="String"/>
    
      <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    
    <force:recordData aura:id="ldsAccountEdit"
     recordId="{!v.AccId}"
     layoutType="FULL"
     mode="EDIT"
     targetRecord="{!v.newRFA}"
     targetFields="{!v.simpleNewRFA}"
     targetError="{!v.newRFAError}" />

<force:recordData aura:id="AccountRecordCreator"
     layoutType="FULL"
     mode="EDIT"
     targetRecord="{!v.newRFA}"
     targetFields="{!v.simpleNewRFA}"
     targetError="{!v.newRFAError}" />  
    
    
    
    <div class="slds-grid slds-wrap">
            <div class="slds-col slds-size_1-of-1">
     <lightning:tabset variant="vertical" selectedTabId="{!v.selTabId}" >
    <aura:iteration items="{!v.TabsList}" var="t">
        
              <lightning:tab id="{!t.Tab.Name}" label="{!t.Tab.Name}">
              
                    <aura:iteration items="{!t.HeaderList}" var="Header">
                        
                        <div class="slds-col slds-size_1-of-1">
                            <h2 class="header slds-m-left_x-small">{!Header.HeaderSequence__c}.{!Header.Name}</h2></div>
                        <div class="slds-grid slds-wrap">
                        <aura:iteration items="{!Header.ModelTabQuestions__r}" var="Q">
                                       
                                      <div class="{!Q.column__c}">
                                        <lightning:input type="{!Q.FieldType__c}" class="slds-m-around_x-small" name="input1"  label="{!Q.Questions__c}" value="{!v.simpleNewRFA+'.'+v.FieldName__c}"/>
                                        </div>
                             
                            </aura:iteration></div>
                  </aura:iteration>
             </lightning:tab>
       
        
        </aura:iteration>
          </lightning:tabset>
        </div>
    </div>
   
</aura:component>
 
Hello,

I have a Lightning component on my opportunity page that does the following:
  • When clicking on the button, it opens a Lightning modal box
  • This modal box display a Visualforce page, renderas PDF, inside an iframe.
  • I have two button bellow: Cancel, Save
The purpose is to generate and save a PDF to the current record. the modal box allows to preview the document before saving attach it.

-> My issue is: how to save the PDF generated by the Visualforce page, and attach it to the Opportunity?
Any ideas?

demoModal.cmp:
<aura:component implements="flexipage:availableForAllPageTypes,force:hasRecordId" access="global">
  <!--use boolean attribute for Store true/false value,
    make default to "false" so modal box are not display on the load of component. 
    --> 
    
    <aura:attribute name="recordId" type="Id" />

  <aura:attribute name="isOpen" type="boolean" default="false"/>
 
  <!--Use "slds-m-around- -xx-large" class to add standard Large padding to the component--> 
  <div class="slds-m-around--xx-large">
    <button class="slds-button slds-button--brand" onclick="{!c.openModel}">Create a document</button>  
    
  <!--Use aura:if tag to display Model Box, on the bese of conditions. [isOpen boolean attribute] -->   
    <aura:if isTrue="{!v.isOpen}">
      
   <!--###### MODAL BOX Start From Here ######--> 
      <div role="dialog" tabindex="-1" aria-labelledby="header99" class="slds-modal slds-fade-in-open ">
        <div class="slds-modal__container">
          <!-- ###### MODAL BOX HEADER Part Start From Here ######-->
          <div class="slds-modal__header">
            <button class="slds-button slds-modal__close slds-button--icon-inverse" title="Close" onclick="{!c.closeModel}">
            X
            <span class="slds-assistive-text">Close</span>
            </button>
            <h2 id="header99" class="slds-text-heading--medium">Your document</h2>
          </div>
          <!--###### MODAL BOX BODY Part Start From Here ######-->
            <iframe src="{! '/apex/monpdf?Id='+v.recordId}" width="100%" height="500px;" frameBorder="0"/>
          <div class="slds-modal__content slds-p-around--medium">
            <p><b>Some random text.
              </b>
            </p>
          </div>
          <!--###### MODAL BOX FOOTER Part Start From Here ######-->
          <div class="slds-modal__footer">
            <button class="slds-button slds-button--neutral" onclick="{!c.closeModel}" >Cancel</button>
            <button class="slds-button slds-button--brand" onclick="{!c.savenClose}">Save the document</button>
          </div>
        </div>
      </div>
      <div class="slds-backdrop slds-backdrop--open"></div>
      <!--###### MODAL BOX Part END Here ######-->
    
 </aura:if>
  </div>
</aura:component>

monpdf.vfp:
<apex:page standardController="Opportunity" showHeader="false" renderAs="pdf">
{!Opportunity.Account.Name}
</apex:page>

demoModalController.js
({
   openModel: function(component, event, helper) {
      // for Display Model,set the "isOpen" attribute to "true"
      component.set("v.isOpen", true);
   },
 
   closeModel: function(component, event, helper) {
      // for Hide/Close Model,set the "isOpen" attribute to "Fasle"  
      component.set("v.isOpen", false);
   },
 
   savenClose: function(component, event, helper) {
      // Display alert message on the click on the button from Model Footer 

      
       alert('It works');
      component.set("v.isOpen", false);
   },
})

 
Hello , 

I need a help on Advanced Apex Specialist Step 8 , I have created the test classes and all of them successfully executed , overall coverage is 86 however I am facing this issue.

Challenge Not yet complete... here's what's wrong: 
Ensure that after you clear test data, you run your tests once and the required test coverage is achieved.

can anyone help 

Thanks