You need to sign in to do that
Don't have an account?
Sven Francornel
Lightning Component Framework Specialist Step 7 issue
Hello,
I am experiencing an issue while verifying step 7 of the Lightning Component Framework Specialist superbadge.
The boat id is being set correctly when I filling in the form and the created record also has the Boat__c field filled in. I have been trying several ways to get past the verification, but I haven't been able to get past it. Does anyone see what I am doing wrong? Below you are able to see the onInit function.
I am experiencing an issue while verifying step 7 of the Lightning Component Framework Specialist superbadge.
The boat id is being set correctly when I filling in the form and the created record also has the Boat__c field filled in. I have been trying several ways to get past the verification, but I haven't been able to get past it. Does anyone see what I am doing wrong? Below you are able to see the onInit function.
onInit : function(cmp, evt) { cmp.find("service").getNewRecord( "BoatReview__c", null, false, $A.getCallback(function() { var error = cmp.get("v.recordError"); if(error || (rec === null)) { console.log("Error initializing record template: " + error); return; } else { var rec = cmp.get("v.boatReview"); rec.Boat__c = cmp.get('v.boat').Id; cmp.set('v.boatReview', rec); } }) ); }
All Answers
You've used "rec" on line 08 before I see it declared.
While that is technically legal in JavaScript, I'm not sure LockerService allows it.
Anyway, if it is allowed, the value will be null and you'll never reach your else clause.
You probably want to move line 13 between 06 and 08.
Speaking of the else, you shouldn't need line 15.
As you are getting an object, it is passed by reference.
While you do NOT need line 15, the geniuses who created the Trailhead apparently don't know JavaScript well enough.
So, you need it to pass, even though it is useless code.
I changed it back to what I originally had and what you suggested, but that also isn't working.
Many thanks for the help!
i get error when i click on the Add Review tab:
Here is my helperJS:
Looks like its not able to read the Boat__c id, although i am passing the attribute from BoatDetails.
Not sure whats wrong here,
Any help would be highly appreciated.