You need to sign in to do that
Don't have an account?
Willi Werkel
OpportunityStageTips Trailhead Challenge
Hi,
I am doing the "Add a Mobile Card that Displays Content Based on Opportunity Stage" challenge. It asks for a Visualforce page which displays content depending on opportunity stage.
I used the following code
<apex:outputText rendered="{!CONTAINS(opportunity.stagename,'Prospecting')}" value="this is a good idea" />
<apex:outputText rendered="{!CONTAINS(opportunity.stagename,'Analysis')}" value="do this" />
<apex:outputText rendered="{!CONTAINS(opportunity.stagename,'Proposal')}" value="do that" />
<apex:outputText rendered="{!CONTAINS(opportunity.stagename,'Negotiation')}" value="go away" />
and it works in the browser, but the challenge checks complains:
"The page isn't evaluating the 'Prospecting' stage. "
Any idea why?
I am doing the "Add a Mobile Card that Displays Content Based on Opportunity Stage" challenge. It asks for a Visualforce page which displays content depending on opportunity stage.
I used the following code
<apex:outputText rendered="{!CONTAINS(opportunity.stagename,'Prospecting')}" value="this is a good idea" />
<apex:outputText rendered="{!CONTAINS(opportunity.stagename,'Analysis')}" value="do this" />
<apex:outputText rendered="{!CONTAINS(opportunity.stagename,'Proposal')}" value="do that" />
<apex:outputText rendered="{!CONTAINS(opportunity.stagename,'Negotiation')}" value="go away" />
and it works in the browser, but the challenge checks complains:
"The page isn't evaluating the 'Prospecting' stage. "
Any idea why?
Perhaps it is explicitly looking for True and False statement in rendered condition or perhaps not supporting Contains in that case.
Following code worked for me.
Thanks,
Himanshu
Salesforce Certified Developer | Administrator | Service Cloud Consultant
P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
indeed the challenge check seems to have problems recognizing the CONTAINS function. When I modified my code to this
<apex:outputText rendered="{!if(Opportunity.stagename=='Prospecting',true,false)}" value="this is a good idea" />
<apex:outputText rendered="{!CONTAINS(opportunity.stagename,'Analysis')}" value="do this" />
<apex:outputText rendered="{!CONTAINS(opportunity.stagename,'Proposal')}" value="do that" />
<apex:outputText rendered="{!CONTAINS(opportunity.stagename,'Negotiation')}" value="go away" />
the check complained about "Need Analysis" check missing.
Trailhead developers: your chance to improve this great training program a tiny little bit.
Willi
That is correct. they are doing exact match instead of contains. They should improve this.
Thanks,
Himanshu
https://developer.salesforce.com/forums/?id=906F0000000MHKkIAO
The original post had used the same approach I was using, i.e. javascript. The end result is great. it uses the Salesforce resources rather than trying to do it by conventional programming.