• Aashish sajwan 9
  • NEWBIE
  • 0 Points
  • Member since 2015
  • consultant
  • Appirio India

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

I am not able to show selected result whereas when All types is selected, all pictures get displayed.
I debugged and found that the result are present in apex class as the respective boattype id is also fetched correctly. Can someone help me out on this
Below is my code snippet
BoatSearchResults.apx
public class BoatSearchResults {
    @AuraEnabled
    public static List<Boat__c> getBoats(String boatTypeId){        
        List<Boat__c> selectedboats = new List<Boat__c>();
        if(boatTypeId != ''){
            return [Select ID, Name, BoatType__c,BoatType__r.Name, contact__r.Name, Geolocation__c, Picture__c from Boat__c where BoatType__c = :boatTypeId];
        }
        else{
            return [Select ID, Name, BoatType__c,  Picture__c from Boat__c ];
        }
    }
}
BoatSearchResultHelper.js

({
    onSearch : function(component) {
        console.log('here1'+component.get("v.boatTypeId"));
        var action = component.get("c.getBoats");
        action.setParams({
            boatTypeId : component.get("v.boatTypeId")
        });
        action.setCallback(this, function(response){
           console.log('returned value' + response.getReturnValue()); 
            var state = response.getState();
            console.log('state'+state);
               if (state === "SUCCESS") {
                     component.set("v.boats", response.getReturnValue());
               }
            if(state === "ERROR"){
                console.log('error'+ response.getError());
            }
            
        });
        $A.enqueueAction(action);
    }
})

When displayed error it shows - "An internal server error has occurred Error ID: 680922774-129075 (-479172012)"