You need to sign in to do that
Don't have an account?
Akshit Huria
Show Delete and Edit command link if record created date is current date
<apex:page controller="pqr"> <apex:form > <apex:pageBlock > <apex:pageBlockTable value="{!links}" var="abc"> <apex:column headerValue="changes" > <apex:commandLink value="{!abc}" action="{!show}"> <apex:param value="{!abc}" name="pp" assignTo="{!pp}" /> </apex:commandLink> </apex:column> <apex:column headerValue=" Action"> <apex:commandLink value="Delete" action="{!del}" rendered="{!d}" > <apex:param value="{!abc}" name="pp" assignTo="{!pp}" /> </apex:commandLink> <apex:commandLink value="Edit" action="{!edt}" rendered="{!e}"> <apex:param value="{!abc}" name="pp" assignTo="{!pp}" /> </apex:commandLink> </apex:column> </apex:pageBlockTable> <apex:pageBlockButtons > <apex:commandButton value="back" action="{!back}"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page>
public class pqr { public List<String> links{get; set;} public String pp{get; set;} public List<quality__c> go{get; set;} public Boolean re{get; set;} public Boolean res{get; set;} public Boolean ed{get; set;} public Boolean cn{get; set;} public Boolean sv{get; set;} public Boolean e{get; set;} public Boolean d{get; set;} public pqr() { re=false; res=true; ed=true; links=new List<String>(); AggregateResult[] ar=[select sdate__c from Quality__c group by sdate__c ]; for(AggregateResult a:ar) { String q= String.valueOf(a.get('sdate__c')); links.add(q); } date dt=System.today(); String g=String.valueOf(dt); for(String p :links) { String[] re=p.split(' '); System.debug(re[0]); System.debug(g); if(re[0] != g) { e=false; d=false; } else { d=true; e=true; } System.debug(d); } } public PageReference show() { cn=false; ed=true; re=false; res=true; sv=false; go=new List<quality__c>(); go=[select name, ab__c, bc__c, cd__c from quality__c where sdate__c=: pp]; PageReference pr=new PageReference('/apex/task4_2'); return pr; } public PageReference back() { PageReference pr=new PageReference('/apex/task4'); return pr; } public PageReference back2() { PageReference pr=new PageReference('/apex/task4_1'); return pr; } public void emode() { re=true; res=false; ed=false; cn =true; sv=true; } public void nmode() { re=false; res=true; ed=true; cn= false; sv=false; } public void tsave() { for(Quality__c s : go) { upsert s; } re=false; res=true; sv=false; cn=false; ed=true; } public PageReference del() { go=new List<quality__c>(); go=[select name, ab__c, bc__c, cd__c from quality__c where sdate__c=: pp]; delete go; PageReference pf=new PageReference('/apex/task4_1'); pf.setredirect(true); return pf; } public PageReference edt() { go=new List<quality__c>(); go=[select name, ab__c, bc__c, cd__c from quality__c where sdate__c=: pp]; re=true; res=false; PageReference pr=new PageReference('/apex/task4_2'); return pr; } }
You can use rendered attribute of apex:commandLink to achieve this:
@Pankaj
Its not working
for your help