function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Radhika BansalRadhika Bansal 

An internal server error has occurred in Lightning component framework specialist superbadge

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)"
 
Vinod ChoudharyVinod Choudhary
Hi Radhika ,

 I also faced the same issue. You can clear browser cache and history and then again login to your account then give a shot and let me know if having another issue.

Thanks
Vinod
Radhika BansalRadhika Bansal
Hi Vinod,

It didn't work for me. Do you have anyother thought.
Aashish sajwan 9Aashish sajwan 9
Hello Radhika,

You can try JSON.serialize in your BoatSearchResult apex class and also use  JSON.parse(response.getReturnValue()) in boatSearchReultHelper.js. It will work well.