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
simhasimha 

Code working in developer edition and not working in free edition public sites

Hi every one,

 

       I wrote a code when page loads, which checks the todays date and time if today date is 9th nov and time is 12.30 pm the code returns null and do rest of the thing else if today is not 9th nov and time is not 12.30  pm it will return to an error message page displaying pleaseopen it on 9 th nov 12.30 pm  to 1 pm.

 

and here is my code.

 

<apex:page showHeader="false" controller="checkmailid" action="{!checkdate}">      

 

APex class 

public PageReference checkdate()
    {      
        PageReference pageRef;
        DateTime t = DateTime.now();        
        if('11-9-2009'!=t.month()+'-'+t.day()+'-'+t.year())//checks today date    
        {                        
            pageRef = new PageReference('http://free-12415f14c3a-124c73aaa62.force.com/registerfor/errormsg?error=dates');                                 
            pageRef.setRedirect(true);                    
            return pageRef;         
        }        
        else //if today date is equal to given date       
        {            
            if(t.Hour()==12)     //this checks if time is equal to 12.30 or not.      
            {                
                if(t.Minute()>=30 )                
                {                        
                    return null;                
                }                
                else                
                {                    
                    pageRef = new PageReference('http://free-12415f14c3a-124c73aaa62.force.com/registerfor/errormsg?error=dates');                                 
                    pageRef.setRedirect(true);                    
                    return pageRef;                 
                }            
            }            
            else            
            {                
                pageRef = new PageReference('http://free-12415f14c3a-124c73aaa62.force.com/registerfor/errormsg?error=dates');                             
                pageRef.setRedirect(true);                
                return pageRef;             
            }        
      }
        return null;
    }

 

when i wrote and tested it on developer edition its working perfectly and when i made it as a package and uploaded it to free edition this time  functionality is not working.

 

 

can any one know what is  wrong with it? why is it not workingin free edition public sites.

 

 

aalbertaalbert
Can you elaborate on what is not working? Is the page loading? And calling the checkdate() method but the method isn't executing properly? Have you enabled Debug Logs? Please elaborate on what is not working.
DSsaranDSsaran

Hi ,

  The checkdate() should allow to go through the rest of the page at 12.30 pm, and it should show error page with message 'the page will be active at 9th nov 2009 at12.30pm' if the date is not equal  to 9 th nov 2009 12.30 pm. but even at 12.30 pm also it shows the same error message in free edition public sites . but its working fine is developer edition .

PragadheeshwariPragadheeshwari

Hai,

 

    For me its perfectly working in developer,Sandbox and Enterprise Edition(Free Editions).Check it out once again,If you have still problem can you able to clarify,what error you are having