• Juraj Ciljak
  • NEWBIE
  • 5 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 7
    Replies
public class KAddNoteControllers {
   public boolean displayPopup {get; set;}
   public ApexPages.StandardController nad;
   public KAddNoteControllers(ApexPages.StandardController controller) {
   }
   public pagereference closePopup() {
   this.nad.save();
       PageReference pageRef = new PageReference('/apex/KDetailpage');
       pageref.setRedirect(true);
       return pageref;
   }

   public void showPopup() {
       displayPopup = true;
   }

    public K_Document__c objNote{get;set;}
    String kId='';
    public KAddNoteControllers(){
        objNote = new K_Document__c();
        kId = ApexPages.currentPage().getParameters().get('id');
    }
    public void save(){
    Datetime yourDate = Datetime.now();
    String dateOutput = yourDate.format('MM/dd/yyyy  h:mm a');
        K_Document__c doc = [Select Id, note__c from K_Document__c where id=:kId];
        if(objNote.note__c <> null){ //format('MM/dd/yyyy HH:mm:ss'
            String note = '<B>' + UserInfo.getName() + '</B>'+ '&nbsp&nbsp' + '<B>'+  yourDate.format('MM/dd/yyyy  h:mm a') + '</B>' ;
            note += '<BR/>' + objNote.note__c;
            doc.note__c = note + '<BR/><BR/>' + common.NVL(doc.note__c);
            
            update doc;
            
            
        }
    }
}
and my test class is ---

@isTest//(SeeAllData=true)
private class test_KAddNoteControllers {
  static testMethod void test_KAddNoteControllers1()
  {
      //page reference
   K_Document__c obj=new K_Document__c ();
   PageReference pageRef = Page.KAddNote;
    System.assertNotEquals(null,pageRef);
    System.assertEquals('/apex/KDetailpage',pageRef.getUrl());
    Map<String,String> pageParameters = pageRef.getParameters();
    System.assertEquals(1,pageParameters.values().size());
    System.assertEquals('recordId',pageParameters.get('id'));
  }
  private static testMethod void showpopup()
    {
        
    }
  private static testMethod void test_KAddNoteControllers2()
  { //add record
      K_Document__c k1=new K_Document__c();
      k1.id='12345';
      k1.note__c='abcde';
      insert k1;
    }  
    //for constructotr
    private static testMethod void test_KAddNoteControllers3()
    {
      K_Document__c k1=new K_Document__c();
       ApexPages.StandardController sc = new ApexPages.standardController(k1);
       KHeaderController controller = new KHeaderController(sc);
      }
    private static testMethod void save()
    {
        
    }
      }
   Please some one help me on this.please. 
  • September 16, 2015
  • Like
  • 0
I have a Scheduler class, I want to check before running this class weather this sceduler class is already scheduled or not in my Apex class?
I am receiving an error on VF Page where Clicking on submit button is freezing the screen and not moving it to next vf page. This is only happening with 1 or 2 users.

ERROR 1:
Uncaught SecurityError: Sandbox access violation: Blocked a frame at "https://c.cs7.visual.force.com" from accessing a frame at "https://c.cs7.visual.force.com".  The frame being accessed is sandboxed and lacks the "allow-same-origin" flag.initContentPane @ VFDevMode.js:21initContentFrame @ VFDevMode.js:22

ERROR 2:
Uncaught SecurityError: Failed to read the 'cookie' property from 'Document': The document is sandboxed and lacks the 'allow-same-origin' flag.getCookie @ main.js:75ActivityReminder._checkScheduleUpdates @ main.js:709

Thanks
I'm going through the Site.com Workbook, trying to add a datatable to a site.com site, but the only data available from a custom object are the standard fields.  I have edited the guest user profile via the site configuration link in the Overview tab of the site to enable read access to the custom object.  I can not find where to set field-level security on the custom object because the guest user profile is not included in the list of available profiles for the objects FLS.