• Anjum Attar 26
  • NEWBIE
  • 5 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 11
    Replies
school__c -->customObject
studentjoinage =system.today() - createddate; //its formula field which riturn number.
I written the batchclass,in that   if(sch.studentjoinage__c==30) then send an email.
test.starttest
   mybatchcls mb=new mybatchcls();
   database.execute();
test.stoptest;
i get 40% codecoverage, in that start method ,finish methods r coverd but in execute method after if condition which means
messaging.singleemailmessage not coverd bcoze formula field.
i need help here to cover formula field.   
public PageReference sendEmail(){
        
        try{ 
            if(String.isBlank(toEmail)) {
                ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.ERROR, 'Please enter To Address'));
                
                return null;
            }
            if(String.isBlank(subject)) {
                ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.ERROR, 'Please enter Subject'));
                        return null;                
            }
public class prijava_controller 
{
    public String idDel                 {get;set;}
    public list<Student__c> lista         {get;set;}
    
    public prijava_controller(ApexPages.StandardController controller){
       
        query();
        lista = new list<Student__c>();
  
    }

      public void deleterow()
      {
          String myId = System.currentPageReference().getParameters().get('rowId');  
 
                for(Integer i=0; i<lista.size(); i++) 
                {
                    Student__c c = lista[i];
                    if (c.Id == myId) 
                    {
                      lista.remove(i); // remove item only from list for avoid dispaly this item on vf page
                      // delete(c); - delete record from database
                      break;
                        }
                 }  

          
           }


apex:
                <apex:repeat value="{!lista}" var="s">      
                                                    
                    <TR>
                        
                        <TD>
                       <apex:commandButton  value="{!deleterow(s.Id)}" styleClass="delete">
                        <apex:param name ="rowId" value="{!deleterow(s.Id)}"/>
                        </apex:commandButton> 

                        </TD>

User-added image
Hi All,

i have a standard opportunity page. also i have a field update on this. so i have to auto refresh my opportunity page when a field update happen. now i need to manully refresh the page. how can i achieve this. i have written a inline visual force page with a 'Reload' button embadded with the satndard page. but i need to manually click this button. i need the auto refresh the page.

Thanks,

I've discovered that when using the following object I get some strange behavior, and I'm wondering if anyone can point out what I'm doing wrong??

 

The following setup returns the campaigns list correctly filtered by the paramters in the associated FilterId for the 'Campaign' object but the orderby clause is invalidated and the campaigns are sorted by the 'last selection on the standard list view vf component' under the default campaigns tab, so ordered by 'Name' or 'Type' or whatever...not 'StartDate ASC' as set.

ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(Database.getQueryLocator([SELECT Id, Name, StartDate, EndDate, Type, Status, Description, Owner.Name,NumberOfLeads, NumberOfContacts, NumberOfOpportunities, NumberOfWonOpportunities,AmountAllOpportunities, Exclude_from_Calendar__c FROM Campaign ORDER BY StartDate ASC]));
ssc.setFilterID(this.filterId);
ssc.setPageSize(2000);
// use standardset controller to limit results by listview
List <Campaign> campaignObjects = ssc.getRecords();	

 The following setup returns the campaigns list correctly sorted using the ORDER BY clause, but they are not FILTERED by the associated listview filterid using 'setFilterId('...')'

List<Campaign> campaigns = [SELECT Id, Name, StartDate, EndDate, Type, Status, Description, Owner.Name,NumberOfLeads, NumberOfContacts, NumberOfOpportunities, NumberOfWonOpportunities,AmountAllOpportunities, Exclude_from_Calendar__c FROM Campaign ORDER BY StartDate ASC];
ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(campaigns);
ssc.setFilterID(this.filterId);
ssc.setPageSize(2000);
// use standardset controller to limit results by listview
List <Campaign> campaignObjects = ssc.getRecords();	

 

What am I missing about ordering these campaigns correctly...