• #21387
    Salesforce | Shubham Shubham #120
    Forcetalks

    Can we get value of a particular field of object on a link in Salesforce?

    i want to get value of name of account on click of a link???

     

    • This topic was modified 1 year, 3 months ago by Salesforce | Shubham Shubham.
    • This topic was modified 1 year, 3 months ago by Salesforce | Team Team.
    • This topic was modified 1 year, 3 months ago by Salesforce | Team Team.
    #21768
    Salesforce | shariq shariq #1
    Forcetalks

    Hi Shubham,

    Apex Controller:-

    public class AccountNameLink
    {
    public List<Account> accList {get;set;}
    public List<Account> accList2 {get;set;}
    public String linkId{get;set;}
    public AccountNameLink()
    {
    accList = [SELECT Name FROM Account LIMIT 100];
    linkId = ”;
    accList2 = new List<Account>();
    }
    public void showAccounts()
    {
    accList2 = [SELECT Name, Description FROM Account WHERE Id =:linkId];
    }
    }

    Apex Page:-

    <apex:page controller=”AccountNameLink”>
    <apex:form>
    <apex:pageBlock>
    <apex:repeat value = “{!accList}” var =”acc” >
    <apex:commandLink value=”{!acc.Name}” action =”{!showAccounts}” reRender=”pb”>
    <apex:param value=”{!acc.Id}” Name=”Account Id” assignTo=”{!linkId}”/>
    </apex:commandLink>
    <br/>
    <apex:pageBlockTable value = “{!accList2}” var=”acc2″ columns=”3″ Id=”pb”>
    <apex:column value = “{!acc2.Description}”/>
    <apex:column value = “{!acc2.Name}”/>
    </apex:pageBlockTable>
    </apex:repeat>
    </apex:pageBlock>
    </apex:form>
    </apex:page>

     

    Hope this Helps.

     

     

    #34555
    Salesforce | Parul Parul #2
    Forcetalks

    Hi

    <apex:pageBlock >
    <apex:pageBlockButtons>
    <apex:commandButton value=”Click” action=”{!main}” reRender=”one”/>
    </apex:pageBlockButtons>
    <apex:pageBlockSection id=”one”>
    <apex:pageBlockTable value=”{!accs}” var=”a”>
    <apex:column headerValue=”Account hyperlink”>
    <apex:outputlink value=”/{!a.Id}”>{!a.Name}</apex:outputlink>
    </apex:column>
    <apex:column value=”{!a.name}”/>
    </apex:pageBlockTable>
    </apex:pageBlockSection>
    <apex:commandButton value=”Click” action=”{!main}” reRender=”one”/>
    </apex:pageBlock>

     

    Thanks

Viewing 3 posts - 1 through 3 (of 3 total)

Please to reply to this topic.

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2018 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?