+ Start a Discussion
chithra srinivasanchithra srinivasan 

The page does not bind to the record ID value (in order to link to the record detail page) in VisualForce trailhead challenge

Hi,
    Eventhough my code works i still get the error "The page does not bind to the record ID value (in order to link to the record detail page) " when i tried to check in the challenge. any help is appreciated.
code below:
<apex:page standardController="Account" recordSetVar="accounts" >
   <apex:pageBlock title="Account List">
      <!-- accounts List -->
       <apex:repeat value="{! accounts }" var="a">
          <li>
            <apex:outputLink value="/{!LEFT(a.Id,15)}">/{!LEFT(a.Id,15)} </apex:outputLink>
          </li>
</apex:repeat>
</apex:pageBlock>
</apex:page>

Thanks
chithra srinivasanchithra srinivasan
Hi Nayana,      Thanks for getting back to me. I am doing visualforce basics using standard list controllers challenge. how can i check in the for challenge?  Thanks
chithra srinivasanchithra srinivasan
Hi,
Any input for the above code so as not to get the error "The page does not bind to the record ID value (in order to link to the record detail page) in VisualForce trailhead challenge" while check in the challenege? 
Thanks.
 
Jeanne BuschJeanne Busch
I am getting the same error, but my code looks a little different:

<apex:page standardController="Account" recordSetVar="accounts">
  <apex:pageBlock title="Account Links">
  <apex:repeat var="a" value="{!accounts}" rendered="true" id="account_list">
    <li>
       <apex:outputLink value="https://ap1.salesforce.com/{!a.ID}" >
        {! a.name}    
      </apex:outputLink>  
    </li>
  </apex:repeat>
  </apex:pageBlock> 
</apex:page>

This code gets me a nice little list of the accounts in my dev org and I can click on any one of them and get to the detail record, so I'm certain I'm getting the result I'm supposed to get.  But I'm still getting the error.  I don't see what my code and Chithra's code has in common that might be causing an error.  Does anyone have an idea about what Trailhead might think is wrong?  Has anyone else passed this challenge successfully who might be willing to share his/her code?

Thanks much--
Jeanne
Logan Smith 15Logan Smith 15
<apex:page standardController="Account" recordSetVar="accounts">
    <apex:repeat value="{! accounts}" var="a">
        <li>        
            <apex:outputLink value="/{! a.ID }">
            Click here {!a.ID}
            </apex:outputLink>
        </li>
    </apex:repeat>   
</apex:page>

This works. Looks like salesforce doesnt want you to append the full URL to the outputlink value. @SalesForce, can you update this? Thanks! 
chithra srinivasanchithra srinivasan
Hi Logan,
     The above code of yours work fine. I tried like that before and it didn't work at that time.Thanks, Chithra
Su Wang 4Su Wang 4
@Salesforce, echo @Logan Smith 15.  Please update your challenge!!! My code with the full URL works fine but kept getting this error is very annoying.  It took too much time off me to follow your strick design of this challenge.
Sydney Lo 19Sydney Lo 19
Switching from Lightning to Classic worked for me.
Nicholas Parrell 6Nicholas Parrell 6
Please state that you want the user to bind not using the full url but only using the a.id field. It is confusing since this can be acheived many different ways.
NejcForceNejcForce
All the previous excercises were pretty straightforward, this one took a huge leap and doesn't explain much about repeat and/or using outputLinks properly
Truc NguyenTruc Nguyen
The answer is <apex:outputLink value="/{! a.Id }">  instead of <apex:outputLink value="/{! URLFOR($Action.Account.Edit, a.Id) }">
Saket Ranjan 3Saket Ranjan 3
@LoganSmith15 thanks.
Murali Polimara 6Murali Polimara 6
When I changed {!URLFOR($Action.Account.Edit, a.Id) } to {!URLFOR($Action.Account.View, a.Id) }, it worked for me:
<apex:page standardController="Account" recordSetVar="accounts">
    <apex:pageBlock title="Accounts List">
        <apex:pageBlockSection >
            <apex:repeat value="{!accounts}" var="a" id="theRepeat">
                <li>
                    <apex:outputLink value="{!URLFOR($Action.Account.View, a.Id) }">
                        {!a.Name}
                    </apex:outputLink>
                </li>
            </apex:repeat>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>

 
Don(Bellevue) MitchellDon(Bellevue) Mitchell
Here is another approach that works for this visualforce trailhead.
 
<apex:page standardController="Account" recordSetVar="accounts">

         <table border="0">
              <tr>
                     <th>Account Name</th>
                     <th>Account URL</th>
             </tr>
             		<apex:repeat var="a" value="{!accounts}">
              <tr>    
                     <td> 
                         <li>
                             {!a.name} 
                         </li> 
                  </td>
                    
                  <td>
                      <li> 
                          <apex:outputLink value="{!URLFOR($Action.Account.View, a.Id) }">{!a.name}</apex:outputLink>
                      </li>
                  </td>
                  
              </tr>    
                        </apex:repeat>
            </table>

</apex:page>

 
Paul WorltonPaul Worlton

Just a heads-up...

Don't use an expression for the URL value.  In Lightning, you MUST use expressions to output a value, e.g.:

value="{! '/' & a.Id }"

In VF, you CAN use an express...but don't.  The challenge will not pass if you do.  Do this instead:

value="/{! a.Id }"
 

.

Jhonny Alexander Ramirez ChiroqueJhonny Alexander Ramirez Chiroque
Esto me funciono a mi
<apex:page standardController="Account" recordSetVar="accounts">
  <apex:pageBlock title="Account Links">
  <apex:repeat var="a" value="{!accounts}" rendered="true" id="account_list">
    <li>
       <apex:outputLink value="/{! a.ID }" >
        {! a.name}    
      </apex:outputLink>  
    </li>
  </apex:repeat>
  </apex:pageBlock> 
</apex:page>

gracias a todos, por sus aportes
ani ghoani gho
Hey this passes the challenge i did exactly as the wording in the challenge not a extra tag or bla it works....
<apex:page standardController="Account" recordSetVar="accounts">
     <apex:repeat value="{! accounts }" var="a">
         
         <li>
         
             <apex:outputLink value="/{!a.ID}"></apex:outputLink>
         
         </li>         
 
    </apex:repeat>
</apex:page>