• Amn12345
  • NEWBIE
  • 25 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 8
    Replies
public class SearchController
{
 public String nameQuery {get; set;}
 public List<Client__c> clients {get; set;}
  
 public PageReference executeSearch()
 {
  String queryStr='%' + nameQuery + '%';
  clients=[select id, Name
            from Client__c
            where name like :queryStr];
            
  return null;
 }
  
 public SearchController()
 {
  // if query appears in URL, execute it
  String urlQuery=ApexPages.currentPage().getParameters().get('query');
   
  if ( (null!=urlQuery) && (0!=urlQuery.length()) )
  {
   nameQuery=urlQuery;
   executeSearch();
  }
 }
}

 Please help me to write test class.....

 

Thanks in advance......

  • February 12, 2013
  • Like
  • 0

I have used escape attribute for richTextArea field still content of my Visualforce page is showing me RTF data on UI like '<span><p> this is desc. </p> </Span>' instead of 'this is desc.'

 

Below is the VF,

 

<apex:pageBlockSection columns="1" >
<apex:repeat value="{!PPPInfo}" var="v">
<apex:outputtext escape="false"> {!v.Status__c} </apex:outputtext>
</apex:repeat>
</apex:pageBlockSection>

 

Is it because the value of richTextArea field is coming from Child of Child Record?

 

Please Help!!

Requrement is to send email using hyperlink of the Contact Name. 

 

I have visualforce page, as soon as user clicks on contact name ( its dynamic, which is shown as text on VF) on which I want to create hyperlink so that it will direct to the contacts associated email address and  outlook window should get open for New email.

 

Please help!!

We have added Content(Standard object) related list to Custom object. And its currently showing 125 records for that custom object. Whereas in actual there are more than 125 records are attached with that custom object.

 

Is there any limit for showing records in related list of Contect? And if yes Please provide the link also.

 

And is there way to bypass link which says Show More in related list? What if I want to see all the records at once like we have in normal related list.

 

Please Help!!

 

Thanks.

Hi,

 

When we call Batch apex using Query in developer console, Can we specify number of record which we need to process at a time after the query?

 

For eg:

 

Id batchInstant = executeBatch(new BatchClass(Select id, Name from Account), 200);

 

In above syntax, 200 represents batch size of 200 So SF will chuncks number of records in 200 records batch.

My question is, if there are 5000 records can we pass directly at 200 place in the above query?

 

Thanks.

I have a question, Why do we need to disable Triggers at the time of Data migtation? And if we have to do this then what abt Data which never gets updated. 

I am not sure how to overcome this situation. Other way round is to update field already in csv file. But that cannot be handle for large number of records.

If anyone faced the same problem please provide your solution.

Thanks.

I need to write a trigger to update 2 fields 1st anniversary date and 6th annivarsary date. I have a field called evalution date.

 

As soon i enter this i want 1st anniversary date to update by 1 year and 1 day less.

Second to update 6th anniversary date year +6 and day -1.

 

I tried this with formula field but using formula i cant ignore leap years eg. When Evalution date is  03/01/2008 (leap year), its not showing me one day before date as - 1 for 1st anniversary. it gets blank in this case.

 

Please Provide any triiger which can calculate dates according to leap year

I have two objects Deal(Parent) and Product(Child). I want to take all the product names which are associated with one Dealand Update it into Deal Object in comma separated format.

 

I know we can do this using VF and Apex. Can you please clarify is it possible through Triggers? And if yes please suggest some solution.

I have a formula which depends on what value is selected,

Options are Take-Out, Acquisition, Both, None.. In formula AND loop for "Both" is not working. My formula is executing fine.

 

IF( 
INCLUDES(Investment_Use__c, "Take-Out"), "Take-Out", 
IF(INCLUDES(Investment_Use__c, "Acquisition" ), "Acquisition", IF( 
AND( 
INCLUDES(Investment_Use__c, "Acquisition" ),
INCLUDES(Investment_Use__c, "Take-Out" ) 
), 
"Both", "None" 
)))

 

What could be the problem?? Please need your help

 

Thanks

Hi,

 

I need help in updating a parent record field with Yes or No value.

 

When I create a child record with lookup field value as hardcoded value, trigger get save but doesnt allow to save child record.

This is the code i am not able to save the child record. On child record I have visualforce page.

 

trigger PopulateDAA on DAA__c (after insert, after update)
{
    set<id> DealIDs = new set<id>();
    set<id> DdataIDs = new set<id>();
    
    for(DAA__c l : trigger.new)
    {
        DealIDs.add(l.Deal__c);
    }
   
    List<Deal__c> deals= [select id, PovRate2530__c from Deal__c where id in :DealIDs ];
    
      deals[0].PovRate2530__c = 'No';
      
        
  for(DAA__c l : trigger.new)
        { 
        
           if(l.Deal__c == 'Poverty Rates Greater Than 25 Percent')
           {
            deals[0].PovRate2530__c = 'Yes';
           
           }

        else

         {
             deals[0].PovRate2530__c = 'No';  
         }
        }
    update deals;    
}

 

This code executes but doesnt work...

As i have VF page on child object its not allowing me to save the record.

 

I feel its a lookup field (Deal__c) so its not reading the value.. may be I am wrong.

 

Please help!!!!

 

Here is my code, I am getting error as, Error: Unknown property 'Product_Association__cStandardController.Program_Association__c'

 

Please help!!!!!!!!!

I have written a trigger to display and error if user try to create more than one record for an object.

Its working fine,

 

trigger ENT_Trigger_OnlyOneFund on Fund__c(before insert)

 { 
integer count = [select count() from Fund__c]; 
if(count>0) 

for(Fund__c L : trigger.New) 

  L.addError('There can be only one record of Fund '); 


}

--------------------------

Than I wrote a test class for the same which is showing me 13% test covegare. 

 

@isTest 
private class TestOnlyOneFund  
{
    static testMethod void validateFund()
    {
     Account a=new Account(Name='Test', AccountNumber='Test1');
     insert a;
     
    Fund__c c= new Fund__c(Fund_Name__c='test', Account__c=a.id);
     insert c;
    
    }
}



Please help what code I should add to increase test coverage for this class.

 

Thanks.

I have used escape attribute for richTextArea field still content of my Visualforce page is showing me RTF data on UI like '<span><p> this is desc. </p> </Span>' instead of 'this is desc.'

 

Below is the VF,

 

<apex:pageBlockSection columns="1" >
<apex:repeat value="{!PPPInfo}" var="v">
<apex:outputtext escape="false"> {!v.Status__c} </apex:outputtext>
</apex:repeat>
</apex:pageBlockSection>

 

Is it because the value of richTextArea field is coming from Child of Child Record?

 

Please Help!!

Hi,

 

When we call Batch apex using Query in developer console, Can we specify number of record which we need to process at a time after the query?

 

For eg:

 

Id batchInstant = executeBatch(new BatchClass(Select id, Name from Account), 200);

 

In above syntax, 200 represents batch size of 200 So SF will chuncks number of records in 200 records batch.

My question is, if there are 5000 records can we pass directly at 200 place in the above query?

 

Thanks.

public class SearchController
{
 public String nameQuery {get; set;}
 public List<Client__c> clients {get; set;}
  
 public PageReference executeSearch()
 {
  String queryStr='%' + nameQuery + '%';
  clients=[select id, Name
            from Client__c
            where name like :queryStr];
            
  return null;
 }
  
 public SearchController()
 {
  // if query appears in URL, execute it
  String urlQuery=ApexPages.currentPage().getParameters().get('query');
   
  if ( (null!=urlQuery) && (0!=urlQuery.length()) )
  {
   nameQuery=urlQuery;
   executeSearch();
  }
 }
}

 Please help me to write test class.....

 

Thanks in advance......

  • February 12, 2013
  • Like
  • 0

I have a formula which depends on what value is selected,

Options are Take-Out, Acquisition, Both, None.. In formula AND loop for "Both" is not working. My formula is executing fine.

 

IF( 
INCLUDES(Investment_Use__c, "Take-Out"), "Take-Out", 
IF(INCLUDES(Investment_Use__c, "Acquisition" ), "Acquisition", IF( 
AND( 
INCLUDES(Investment_Use__c, "Acquisition" ),
INCLUDES(Investment_Use__c, "Take-Out" ) 
), 
"Both", "None" 
)))

 

What could be the problem?? Please need your help

 

Thanks

Hi,

 

I need help in updating a parent record field with Yes or No value.

 

When I create a child record with lookup field value as hardcoded value, trigger get save but doesnt allow to save child record.

This is the code i am not able to save the child record. On child record I have visualforce page.

 

trigger PopulateDAA on DAA__c (after insert, after update)
{
    set<id> DealIDs = new set<id>();
    set<id> DdataIDs = new set<id>();
    
    for(DAA__c l : trigger.new)
    {
        DealIDs.add(l.Deal__c);
    }
   
    List<Deal__c> deals= [select id, PovRate2530__c from Deal__c where id in :DealIDs ];
    
      deals[0].PovRate2530__c = 'No';
      
        
  for(DAA__c l : trigger.new)
        { 
        
           if(l.Deal__c == 'Poverty Rates Greater Than 25 Percent')
           {
            deals[0].PovRate2530__c = 'Yes';
           
           }

        else

         {
             deals[0].PovRate2530__c = 'No';  
         }
        }
    update deals;    
}

 

This code executes but doesnt work...

As i have VF page on child object its not allowing me to save the record.

 

I feel its a lookup field (Deal__c) so its not reading the value.. may be I am wrong.

 

Please help!!!!

 

I have written a trigger to display and error if user try to create more than one record for an object.

Its working fine,

 

trigger ENT_Trigger_OnlyOneFund on Fund__c(before insert)

 { 
integer count = [select count() from Fund__c]; 
if(count>0) 

for(Fund__c L : trigger.New) 

  L.addError('There can be only one record of Fund '); 


}

--------------------------

Than I wrote a test class for the same which is showing me 13% test covegare. 

 

@isTest 
private class TestOnlyOneFund  
{
    static testMethod void validateFund()
    {
     Account a=new Account(Name='Test', AccountNumber='Test1');
     insert a;
     
    Fund__c c= new Fund__c(Fund_Name__c='test', Account__c=a.id);
     insert c;
    
    }
}



Please help what code I should add to increase test coverage for this class.

 

Thanks.