function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Arijit.MajeeArijit.Majee 

Dynamic / Conditional Button

Hello Friends!

 

Need help! New to VF and Apex development! I am working on exiting code to improve and meet business requirement.

 

The business case is when a user search in search box, he will get list of account and related information records in a table in visualforce page. One column of table, user can see a button for request to access that record details.

Right now we have on button in one column and that also html button. I want to change the button from “Request Access” to “Go to” Link [Condition: if the logged in user is owner or record shared access to that record]. How should I proceed? Should I use if condition in VF page or I should write code in controller?

 

 

 

<apex:pageblockTable>

<apex:column>

<input type=”button” value=”Request Access” onlick=”displaymessage(‘{!account.acc.Id}’); align=”center”/>

<apex:column>

<apex:column headervalue=”business unit” style=”----“>

{!account.acc.BU_c}

</apex:column>

 

 

Thanks and appreciation!

Arijit

 

Arijit.MajeeArijit.Majee

 

the visualforce page code is like this. 

 

<apex:pageBlockTable value="{!Refvar_page}" var="account">
            
            
             <apex:column style="width:112px;background-color:#FBF2F4;color:#0D033E">
                
               <input type="button" style="width:110px" value="Request Access" onclick="displaymessage('{!account.acc.Id}');" align="center"/>
                
            </apex:column>
            
            
            <apex:column headerValue="Business Unit" style="background-color:#FBF2F4;color:#0D033E">
                
                 {!account.acc.Source_BU__c} 
                
            </apex:column>
            
            
            <apex:column headerValue="Name" style="background-color:#FBF2F4;color:#0D033E">
                
               <!-- <apex:outputLink value="/{!account.acc.Id}" > {!account.acc.name} </apex:outputLink> -->
                {!account.acc.name} 
                
            </apex:column>