• Sai Sasidhar Bhagavathula
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 6
    Replies
Hi Need quck help if possible, 

Created below modal and tried to iterate a list and created dynamic ids on the modal components, but after pressing button on modal , the find function on lightning controller always says "undefined" value for dynamic ids are just created on modal , I can see other values in modal getting iterated perfectly. 

Modal Code------------------------------------------------------------------>

<div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
                                <aura:iteration items="{!v.fileToBeUploaded}" var="fileDetails">
                                    <lightning:input aura:id="{!'fileName------'+fileDetails.documentId}" value="{!fileDetails.name}" required="true" name="input1" label="Confirm the file name" ></lightning:input>
                                    <lightning:select aura:id="{!'fileAttach-----'+fileDetails.documentId}" name="a_opt" label="Podklady Typ">
                                        <aura:iteration items="{!v.podklady}" var="pdkL">
                                            <option value="{!pdkL.idVal}">{!pdkL.idVal}</option>
                                        </aura:iteration>
                                    </lightning:select>
                                </aura:iteration>
                            </div>
                            <footer class="slds-modal__footer">
                                <lightning:button variant="neutral"
                                                  label="Cancel"
                                                  title="Cancel"
                                                  onclick="{! c.closeModel }"/>
                                <lightning:button variant="brand"
                                                  label="OK"
                                                  title="OK"
                                                  onclick="{!c.submitDetails}"/>
                            </footer>


Lightning Js controller code -------------------------------------------------->
var uploadedFiles = component.get("v.fileToBeUploaded");
for(var i=0; i< uploadedFiles.length; i++){
console.log(component.find('fileName------'+uploadedFiles[i].documentId).get("v.value"));
}
Hello,

I am trying to solve the challange of the HTTP and Basic Callout module of Salesforce trailhead and I am having some queries in which you could point to the right direction:

1- The challange asked us to call this URL https://th-apex-http-callout.herokuapp.com/animals/:id in method getAnimalNameById... should that URL be in this form instead of the above https://th-apex-http-callout.herokuapp.com/animals?id ? Where id is a parameter in the URL.

2- When I tried to check the solution of the challange, Salesforce generated that error for me
"Challenge Not yet complete... here's what's wrong: 
Executing the 'getAnimalNameById' method on 'AnimalLocator' failed. Make sure the method exists with the name 'getAnimalNameById', is public and static, accepts an Integer and returns a String."
despite that my class implementation has this method declared as public static String as below in the code snippet:
 
public class AnimalLocator {
	
	public static String getAnimalNameById(Integer id) {
		
		Http http = new Http();
		HttpRequest request = new HttpRequest();
		request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals?id');
		request.setMethod('GET');
		
		HttpResponse response = http.send(request);
		List<Object> animals = NULL;
		String returnValue = NULL;
		
		// if the request was successful, then parse the JSON response
		if (response.getStatusCode() == 200) {
			Map<String, Object> result = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
			animals = (List<Object>) result.get('animals');
			System.debug(animals);
		}
		
		if (animals.size() > 0 && animals != NULL && id < animals.size()) {
			returnValue = (String) animals.get(id);
		}
		
		return returnValue;
	} // end getAnimalNameById method
    
} // end AnimalLocator class

I would appreciate your help in this post.

Thank you,

Sinan

I have my custom object,with records,i need all my records to be  displayed in my visual force page... when i click on button listrecords...

  • September 06, 2012
  • Like
  • 0