You need to sign in to do that
Don't have an account?
Using Visualforce Pages in Mobile Cards – page isn't evaluating stage error when checking challenge
I'm getting an error when checking the Using Visualforce Pages in Page Layouts and Mobile Cards challenge. The error says that the page isn't evaluating the 'Prospecting' stage, yet the code works when I insert an Opportunity Id where the Stage = Prospecting.
The code:
Cheers,
Justin
The code:
<apex:page docType="html-5.0" standardController="Opportunity"> <style> </style> <apex:remoteObjects > <apex:remoteObjectModel name="Opportunity" fields="Id,StageName" /> </apex:remoteObjects> <div class="myPage"> <h2>Tip for when you're in the {!Opportunity.StageName} Stage:</h2> <p id="stageTip" /> </div> <script> var opportunityStage = "{!Opportunity.StageName}"; document.getElementById("stageTip").innerHTML = createStageTip(); function createStageTip() { if(opportunityStage){ switch(opportunityStage){ case "Prospecting": return "You need to ask really good questions" break; case "Needs Analysis": return "Determine the needs by asking really good questions" break; case "Proposal/Price Quote": return "Make sure the price doesn't exceed the budget" break; case "Negotiation/Review": return "Maybe go down, but don't go down too much" break; default: return "Use your best judgement"; } } } </script> </apex:page>If you have any ideas as to why this isn't working, I'd love to hear them.
Cheers,
Justin
All Answers
My code was even simpler and, like J Dove's, it works, but I too get the "page isn't evaluating the 'Prospecting' stage" announcement.
Here's my code:
Anyone know why this fails the challenge?
What's even worse is that your IF statement solution is actually incorrect. You used the double equals (==) Apex equality operator, when this is a formula and should therefore be using the formula equality operator (=).