• $force
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies

Hi guys,

 

please help me to redirect to the detail page on click a button.

 

Public Class Comments{
public Comments__c Com{get; set;}


id str;
id str1;

public Comments(ApexPages.StandardController controller) {
Com=(Comments__c)controller.getRecord();
str=Apexpages.currentpage().getparameters().get('id');
System.debug('======================================>'+str);
}
public Comments(){
List<Comments__c> c=[select id, Contact__r.Id ,Finance__r.id, Application__r.Id from comments__c where id=:str];
if(c!=null){
for(Integer i=0;i<=c.size();i++){
str1=c[i].Contact__r.Id;
system.Debug('--->'+str1);
}
}

}

public PageReference lead() {
PageReference pageRef = new PageReference('/00Q/o');
return pageRef;
}
public PageReference Applicant() {
PageReference pageRef = new PageReference('/'+c.Contact__r.id);
return pageRef;
}
public PageReference Application() {
PageReference pageRef = new PageReference('/'+c.Application__r.id);
return pageRef;
}
public PageReference Finance() {
PageReference pageRef = new PageReference('/'c.Finance__r.id);
return pageRef;
}
}

 

i am calling the page reference on a button click.when i click that button then they should redirect to that record detail page.

 

Thanks

$F

  • August 18, 2012
  • Like
  • 0

hi guys,

 

Can u please help me in this trigger.

this trigger is inserting duplicate records in updation call and insertion is failed.

please help me in changing code.

i feel map is the gud choice in this trigger

 

trigger doc on federal__c(after insert)

 

Set<Id> sobjectSetOfIds = new Set<Id>();
List<federal__c> flist = new List<federal__c>();
 for(federal__c fs:trigger.new) {
    if(fs.Opportunity__c!=null)
     sobjectSetOfIds.add(fs.Opportunity__c);    
       flist.add(fs);
 }
 list<Conditions__c> comlist = [select id,opportunity__c,Contact__c,Federal__c from Conditions__c where opportunity__c =:sobjectSetOfIds];
 list<Conditions__c> updatedcomlist = new list<Conditions__c>();
 for(Federal__c fss :flist) {
    for(Conditions__c cm: comlist) {     
            cm.federal__c=fss.id;         
            updatedcomlist.add(cm);
        }
    }
    upsert updatedcomlist;
}

 

Thanks

$f

 

  • August 12, 2012
  • Like
  • 0

hi can any on help me in simplifying the code.

 

iam using list and doing some updation on a custom object.
now iwant use map instead of list .can any one simplify it.support bulk operations also.

 

trigger doc on federal__c(after insert)

 

Set<Id> sobjectSetOfIds = new Set<Id>();
List<federal__c> flist = new List<federal__c>();
 for(federal__c fs:trigger.new) {
    if(fs.Opportunity__c!=null)
     sobjectSetOfIds.add(fs.Opportunity__c);    
       flist.add(fs);
 }
 list<Conditions__c> comlist = [select id,opportunity__c,Contact__c,Federal__c from Conditions__c where opportunity__c =:sobjectSetOfIds];
 list<Conditions__c> updatedcomlist = new list<Conditions__c>();
 for(Federal__c fss :flist) {
    for(Conditions__c cm: comlist) {     
            cm.federal__c=fss.id;         
            updatedcomlist.add(cm);
        }
    }
    upsert updatedcomlist;
}

 

 

 

Thanks in advance.

  • August 09, 2012
  • Like
  • 0

hi can any on help me in simplifying the code.

 

iam using list and doing some updation on a custom object.
now iwant use map instead of list .can any one simplify it.support bulk operations also.

 

trigger doc on federal__c(after insert)

 

Set<Id> sobjectSetOfIds = new Set<Id>();
List<federal__c> flist = new List<federal__c>();
 for(federal__c fs:trigger.new) {
    if(fs.Opportunity__c!=null)
     sobjectSetOfIds.add(fs.Opportunity__c);    
       flist.add(fs);
 }
 list<Conditions__c> comlist = [select id,opportunity__c,Contact__c,Federal__c from Conditions__c where opportunity__c =:sobjectSetOfIds];
 list<Conditions__c> updatedcomlist = new list<Conditions__c>();
 for(Federal__c fss :flist) {
    for(Conditions__c cm: comlist) {     
            cm.federal__c=fss.id;         
            updatedcomlist.add(cm);
        }
    }
    upsert updatedcomlist;
}

 

 

 

Thanks in advance.

  • August 09, 2012
  • Like
  • 0