• Kamini
  • NEWBIE
  • 80 Points
  • Member since 2011

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

Hi, 

 

  I am new to SalesForce and Am newbie learning Visual Force and Apex Codding. I created a new custom object with name customer_details_c and desinged a page using visual force. 

 

 In customer_details_c object it has First_Name_c and Last_Name_c as two custom fields. 

 

 Now My requirement is to create a class or controller to insert the data into customer_details_c object. Please suggest me know. How to write the class or controler with an example. 

 

Thanks

Sudhir

I cannot figure out why I am receiving this null pointer exception on line 23. I thought it would be similar to this article: http://cloudnow.wordpress.com/2011/04/04/apex-bloopers-why-art-thou-null/ but the code seems correct to me. The code works when creating single records in the database, but when i try to bulk upload, it fails with the null pointer exception. Any ideas?

 

trigger kiprolerequestTrigger on Application__c (after insert) 
{
    Set<Id> KIPCanIds = new Set<Id>();

    Map<Id, KIP_Candidates__c> kipportalcan = new Map<Id, KIP_Candidates__c>();

    for (Application__c app : Trigger.new) 
    {
       if (app.RecordTypeId == '012C0000000Bhsr' && app.Program__c == 'KIP Summer 2013'){
        KIPcanIds.add(app.Contact__c);
    }
    }
    if(KIPcanIds.size() > 0)
    {
        for(KIP_Candidates__c kippc : [SELECT Id, Associated_Contact__c FROM  KIP_Candidates__c WHERE Associated_Contact__c IN :KIPCanIds])
        {
            kipportalcan.put(kippc.Associated_Contact__c , kippc);
        }
    if(kipportalcan.size() > 0)
    {
        for (Application__c app : Trigger.new)
        {
            Id kipId = kipportalCan.get(app.Contact__c).Id;

            if(kipId <> null)
            {
               app.KIP_Portal_Candidate__c = kipId;
               }   
            }
        }
    }
}

public with sharing class AttachController {
 2	  
 3	  //private ApexPages.StandardController controller { get; set; }
 4	  public List<Deal_License__c> dp{get;set;}
 5	  
 6	     public Deal__c D{get;set;}
 7	      public AttachController(ApexPages.StandardController controller) {
 8	      try
 9	      {
 10	       D = [Select Name,Id,Account__c,Account__r.Name,Rate__c,License_Value__c,Account__r.BillingStreet,Account__r.BillingCity,Account__r.Billingstate,Account__r.BillingPostalcode,Account__r.BillingCountry
 11	                   from Deal__c where id=:controller.getRecord().id];
 12	      system.debug('TestDeal'+D);
 13	      Account acc=[Select Id,BillingStreet,BillingCity,Billingstate,BillingPostalcode,BillingCountry from Account where id=:D.Account__c];
 14	      system.debug('Account%%%%%%%%%%%%%%'+acc);
 15	      dp=[select id,Name,Deal__c,Months__c,List_Price__c,Unit_Price__c,Quantity__c,Total_Value__c from Deal_License__c where Deal__c=:D.Id];
 16	      System.debug('DEALPRDODUCT&&&&&&&&&&'+dp);
 17	      }
 18	      catch(Exception e)
 19	      {
 20	      system.debug('Exception'+e);
 21	      }
 22	      }
 23	      
 24	      public void attach() {
 25	          try{
 26	              Attachment myAttach = new Attachment();
 27	              myAttach.ParentId = ApexPages.currentPage().getParameters().get('id');
 28	              System.debug('Id: ' + ApexPages.currentPage().getParameters().get('id'));
 29	              List<Attachment> at=[Select id from Attachment where parentId=:myAttach.ParentId];
 30	              Integer c=at.size()+1;
 31	              myAttach.name =D.Account__r.Name +''+ 'License Version' + c +'.pdf';
 32	              PageReference psPdf = new PageReference('/apex/Quotation?id=' + ApexPages.currentPage().getParameters().get('id'));
 33	              myAttach.body = psPdf.getContentAsPdf();
 34	  
 35	              insert myAttach;
 36	              
 37	                
 38	              
 39	                         
 40	              System.debug('After attach');
 41	              System.debug(myAttach);
 42	  
 43	              
 44	              /*
 45	              ApexPages.addMessage(new ApexPages.Message
 46	  
 47	  (ApexPages.Severity.CONFIRM,'Quotation has been attached.'));
 48	              */
 49	          }
 50	          catch(Exception e) {
 51	              ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL,'There was an error while attaching'));
 52	              System.debug('Exception');
 53	          }
 54	      }
 55	      
 56	     public PageReference QA() {
 57	     
 58	       PageReference secondPage = new PageReference('/apex/EmailQuote?id=' + ApexPages.currentPage().getParameters().get('id'));
 59	  
 60	        Attachment myAttach = new Attachment();
 61	              myAttach.ParentId = ApexPages.currentPage().getParameters().get('id');
 62	              System.debug('Id: ' + ApexPages.currentPage().getParameters().get('id'));
 63	              List<Attachment> at=[Select id from Attachment where parentId=:myAttach.ParentId];
 64	              Integer c=at.size()+1;
 65	              myAttach.name = D.Account__r.Name +''+ 'License Version' + c +'.pdf';
 66	              PageReference psPdf = new PageReference('/apex/Quotation?id=' + ApexPages.currentPage().getParameters().get('id'));
 67	              myAttach.body = psPdf.getContentAsPdf();
 68	  
 69	              //insert myAttach;
 70	                
 71	              secondPage.setRedirect(true);   
 72	              return secondPage; 
 73	              
 74	      }
 75	      public PageReference back() {
 76	          attach();
 77	          PageReference pr = new PageReference('/' + ApexPages.currentPage().getParameters().get('id') +'#'+ ApexPages.currentPage().getParameters().get('id') + '_RelatedNoteList_target');
 78	          pr.setRedirect(true);
 79	          System.debug('Inside back');
 80	          return pr;
 81	      }
 82	         public PageReference cancel() {
 83	         PageReference pr = new PageReference('/' + ApexPages.currentPage().getParameters().get('id') +'#'+ ApexPages.currentPage().getParameters().get('id') + '_RelatedNoteList_target');
 84	         pr.setRedirect(true);
 85	         System.debug('Inside back');
 86	         return pr;
 87	         }
 88	         
 89	      
 90	        
 91	       /*public String attachmentName{get; set;}
 92	        public pagereference AttachQuote(){
 93	          Pagereference pdf = page.Quotation;
 94	          blob  b=pdf.getcontent();
 95	        
 96	           attachment att = new attachment();
 97	           att.parentId = ApexPages.currentPage().getParameters().get('id') ;
 98	           att.body = b;
 99	           att.name = 'Quotation.pdf';     
 100	           insert att;
 101	           return null;
 102	           
 103	           
 104	        
 105	        }*/
 106	         /*test methods here*/
 107	       public  static testMethod void testAttachController()
 108	        {    
 109	         Profile p = [SELECT Id FROM Profile WHERE Name='Standard User']; 
 110	    
 111	   User U = new User(Alias = 'TUser1', Email='testItemaster1@im.com',EmailEncodingKey='UTF-8',
 112	     LastName='TestingAcc1', LanguageLocaleKey='en_US',LocaleSidKey='en_US', ProfileId =p.Id,
 113	     TimeZoneSidKey='America/Los_Angeles', UserName='testacc1@test.com');   
 114	   insert U;
 115	          
 116	          Account acc=new Account
 117	  
 118	  (Name='rose',BillingCity='bang',Billingstate='kat',BillingPostalcode='560000',BillingCountry='india');
 119	          insert acc;
 120	           system.debug('########555'+ acc);
 121	          Deal__c opp=new Deal__c(Name='test12',Account__c=acc.id);
 122	          insert opp;
 123	          system.debug('########7765'+ opp);
 124	       
 125	                  
 126	          Attachment myAttach1 = new Attachment();
 127	          myAttach1.ParentId =opp.id;
 128	          myAttach1.name = 'Quotation.pdf';
 129	          myAttach1.body = blob.valueof('test');
 130	            
 131	          insert myAttach1;
 132	          
 133	          
 134	          system.debug('Attahment1'+ myAttach1);
 135	       
 136	          AttachController atc = new AttachController(new ApexPages.StandardController(opp));
 137	          system.debug('%%%%%'+atc);
 138	          PageReference pageRef = Page.Quotation;
 139	          pageRef.getParameters().put('id', String.valueOf(opp.Id));
 140	          Test.setCurrentPage(pageRef);
 141	         Blob b;
 142	  
 143	  
 144	         AttachController atc1 = new AttachController(new ApexPages.StandardController(myAttach1));
 145	          
 146	          atc1.attach();
 147	          atc.back();
 148	          atc.cancel();
 149	          //atc.QA();
 150	         
 151	          
 152	          return;
 153	         /* public PageReference QA() {
 154	       PageReference secondPage = new PageReference('/apex/EmailQuote?id=' + 
 155	  
 156	  ApexPages.currentPage().getParameters().get('id'));
 157	          
 158	         insert myAttach1;
 159	         secondPage.setRedirect(true);   
 160	              return secondPage;
 161	              }*/
 162	       
 163	        //Attachment atchoo = [Select Id,  From Attachment where Name like 'Quotation.pdf' 
 164	  
 165	  
 166	         /* if (Test.isRunningTest())
 167	  {
 168	     b=Blob.valueOf('Test Blob String');
 169	  }
 170	  else
 171	  {
 172	    b= pageRef.getContent();
 173	  }*/
 174	  
 175	           }
 176	           
 177	        }

 when i am trying to keep atc.QA();

Error message:Methods defined as TestMethod do not support getContent call, test skipped

 

 

can u pls anybody help in solving this

Hi,

 

Is there any way to add hyperLink to a record in Chatter Meassge using Apex Code. Suppose following is the chatter message:

 

Work has been accepted and assigned to Contact.

 

In the above message the Coantct is the hyperlink to the contact record. Please help me for creating the hyperLink to contact record.

 

Thanks,

  • February 25, 2013
  • Like
  • 0

We can use two methods for globalization.

First is Translation Workbench and another one is Localizing with the Force.com IDE.

Which one is easy to use?

Can we done language translation for an output label field using translation workbench?

Please suggest.

We can connect to an external server through HTML code which is written below:

 

<html>  

<FORM METHOD="POST" ACTION="https://www.signom.com/test-server/authentication/Service.signom"> 

<INPUT NAME="version" TYPE="text" VALUE="1.0"> </INPUT> 

<INPUT NAME="requestId" TYPE="text" VALUE="2010028"></INPUT>

<INPUT NAME="customerId" TYPE="text" VALUE="TEST_SALESSEEKERS"></INPUT>

<INPUT NAME="queryFlags" TYPE="text" VALUE="enable-strong-identification+return-ssn+return-user-name">

<INPUT type="submit" value="Send"></INPUT>

</FORM>

</html>

 

But connecting to the same server with Apex code is creating problems. We are getting :

 

System.HttpRequest[Endpoint=https://www.signom.com/test-server/authentication/Service.signom, Method=POST]

System.HttpResponse[Status=Moved Temporarily, StatusCode=302]

 

Following is the Apex code snippet:

 

req.setEndpoint('https://www.signom.com/test-server/authentication/Service.signom');            

req.setMethod('POST');   

Http http = new Http(); 

HttpRequest req = new HttpRequest();  

HttpResponse res = new HttpResponse(); 

req.setBody('version='+EncodingUtil.urlEncode(version, 'UTF-8')+'&requestId='+EncodingUtil.urlEncode(requestId, 'UTF-8')+'&customerId='+EncodingUtil.urlEncode(customerId, 'UTF-8')+'&queryFlags='+EncodingUtil.urlEncode(queryFlags, 'UTF-8'));           

                            

I could not understand why this error is coming. 

 

please suggest.





I want the following code which does 2 different things to be in class and want to write a trigger to call the class.

Can someone suggest best way to do it or how to do it.

 

thanks

 

 

trigger Checkcase on Case (before update) {

/*
On Update contact name field, update web email field.
On change of status to values given below, check case team is there, if not throw message.
*/

public Set<Id> setContactId = new Set<Id>();
public Map<Id,Contact> mapContact;

 

Public Set<Id> setCaseId = new Set<Id>();
Public Map<Id, CaseTeamMember> mapCaseWithteamMember=new Map<Id, CaseTeamMember>();

 

Id recTypename = Schema.SObjectType.Case.getRecordTypeInfosByName().get('Escalation').getRecordTypeId();

for (Case c : Trigger.new)
{
    if(c.Status != Trigger.oldMap.get(c.Id).Status && c.RecordTypeId==recTypename && (c.status == 'Active Engaged'
    || c.status == 'Active Wait' || c.status == 'Analysis'|| c.status == 'Closed'))
        {
        setCaseId.add(c.Id);
        }
setContactId.add(c.ContactId);

}

 

// 1. on contact change, change the contact email
 mapContact =new Map<Id,Contact>([SELECT id, email FROM contact  WHERE Id IN: setContactId]);
    if (!mapContact.ISEMPTY()){
        for(Case c: Trigger.New){
             if(mapContact.get(c.ContactId) !=null && mapContact.get(c.ContactId).Email !=null){
                 c.SuppliedEmail = mapContact.get(c.ContactId).Email;
             }   
        }
   }


   if(setCaseId.ISEMPTY())   
      return;

 

 

// 2. Find case team, if empty, throw message before status change.


For(CaseTeamMember ct: [SELECT parentid FROM CaseTeamMember  WHERE parentid IN :setCaseId]){
mapCaseWithteamMember.put(ct.ParentId,ct);
}

for(Case c: Trigger.New){
              if(mapCaseWithTeamMember.get(c.Id) ==null && c.RecordTypeId==recTypename) {
                   c.addError('No case team is assigned, please assign a team member.');
              }
     }
    
     }

Hi, 

 

  I am new to SalesForce and Am newbie learning Visual Force and Apex Codding. I created a new custom object with name customer_details_c and desinged a page using visual force. 

 

 In customer_details_c object it has First_Name_c and Last_Name_c as two custom fields. 

 

 Now My requirement is to create a class or controller to insert the data into customer_details_c object. Please suggest me know. How to write the class or controler with an example. 

 

Thanks

Sudhir

 

Does anybody have an idea of how to add a list of records to a Standardsetcontroller records.

 

List<Order_c> orderlist1 = this.getordheaderList1();
List<Order_c> orderlist2 =(List<Order__c>)this.totalOrders.getRecords();

orderlist2.addAll(orderlist1);
	

 

 It is throwing an error as " collection is Read only" while adding the lists.

 Does anybody have an idea how to implement that.

 

 I need to show all the list of records on a vf page.

  • March 02, 2013
  • Like
  • 0

HI All,

 

I have declared a global variable in outer class and trying to access that varibale in inner class method it is showing error.

 

Can any one help me plz it very urgernt.

global class GlobalTest{   

    global String value='Situ';      

    public class Myclass{            

          public void  gtestMethod(){                  

               System.debug(value);     

          }

      }  

}

Error is like Variable does not exist: value at line 6 column 24

Thanks

Situ

I cannot figure out for the life of me why I am getting the CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Glen_Task_Chatter: execution AfterInsert error

 

test code:

public with sharing class test_Glen_Task_Chatter {

    /*
    *    Test the ChatterActivity trigger which inserts chatter feed posts whenever a task is inserted on the parent object
    */
    public static testMethod void testChatterActivity() {
        //create the test account
        
        User u1 = [select id from User where alias='gbrad'];
        
//Run As U1  
    
        System.RunAs(u1){
        
        Account a = new Account(name='Test Account', Type='Law Firm', Industry='Agriculture', BillingCity='Indianapolis', BillingCountry='USA');
        insert a;
        
        Contact c = new Contact(LastName='Test Account', AccountId=a.id, Title='test', Email='g@g.com', LeadSource='Adwords');
        insert c;

        //create a task on that account
        Task t = new Task(Subject='Subject', Contact_Outreach__c='Log A Phone Meeting',WhoId=c.Id,WhatId=a.id,Ownerid=u1.id);
        insert t;
        
        //Event e = new Event (Subject='Subject', Related_Services__c='Consulting', DurationInMinutes=30, ActivityDateTime=datetime.now());
        //insert e;
        
        }
    }
}

 

Actual Trigger:

trigger Glen_Task_Chatter on Task (after insert, after update) {

    if(UserInfo.getName()!='Eloqua Marketing'){
    
        List<FeedItem> feedItems = new List<FeedItem>();
    //We want to show the User name as assignedTo. The only way to get to that is by querying the user table.
        Set<ID> ownerIds = new Set<ID>();
        
        for (Task t : Trigger.new) {
            ownerIds.add(t.ownerId);
        }
        Map<ID,User> userMap = new Map<ID,User>([SELECT ID, Name FROM User WHERE ID IN :ownerIds]); //This is our user map
    
    
    
        for (Task c: Trigger.new) {
                
                    FeedItem fitem = new FeedItem();
                    fitem.type = 'LinkPost';
            		if (c.Accountid != null)
                    	fitem.ParentId = c.Accountid;
                    fitem.LinkUrl = '/' + c.id; //This is the url to take the user to the activity
                    fitem.Title = 'View';  //This is the title that displays for the LinkUrl
        
                    //Get the user by checking the userMap we created earlier
                    User assignedTo = userMap.get(c.ownerId);
        
                    fitem.Body = ((Trigger.isInsert) ? 'New' : 'Updated') + ' Task - ' + c.Subject +': ' + c.Contact_Outreach__c + '\n  ' + c.Description.substring(0,50); //+ c.Who.Name;
                    
                    if (c.AccountId !=null)
                        feedItems.add(fitem);
                
        //}
    
    
        //Save the FeedItems all at once.
        if (feedItems.size() > 0) {
            Database.insert(feedItems,false); //notice the false value. This will allow some to fail if Chatter isn't available on that object
        }
    
    
        
    
        }
        
        
        
        
        
    }

    
    
    
}

 

I cannot figure out why I am receiving this null pointer exception on line 23. I thought it would be similar to this article: http://cloudnow.wordpress.com/2011/04/04/apex-bloopers-why-art-thou-null/ but the code seems correct to me. The code works when creating single records in the database, but when i try to bulk upload, it fails with the null pointer exception. Any ideas?

 

trigger kiprolerequestTrigger on Application__c (after insert) 
{
    Set<Id> KIPCanIds = new Set<Id>();

    Map<Id, KIP_Candidates__c> kipportalcan = new Map<Id, KIP_Candidates__c>();

    for (Application__c app : Trigger.new) 
    {
       if (app.RecordTypeId == '012C0000000Bhsr' && app.Program__c == 'KIP Summer 2013'){
        KIPcanIds.add(app.Contact__c);
    }
    }
    if(KIPcanIds.size() > 0)
    {
        for(KIP_Candidates__c kippc : [SELECT Id, Associated_Contact__c FROM  KIP_Candidates__c WHERE Associated_Contact__c IN :KIPCanIds])
        {
            kipportalcan.put(kippc.Associated_Contact__c , kippc);
        }
    if(kipportalcan.size() > 0)
    {
        for (Application__c app : Trigger.new)
        {
            Id kipId = kipportalCan.get(app.Contact__c).Id;

            if(kipId <> null)
            {
               app.KIP_Portal_Candidate__c = kipId;
               }   
            }
        }
    }
}

public with sharing class AttachController {
 2	  
 3	  //private ApexPages.StandardController controller { get; set; }
 4	  public List<Deal_License__c> dp{get;set;}
 5	  
 6	     public Deal__c D{get;set;}
 7	      public AttachController(ApexPages.StandardController controller) {
 8	      try
 9	      {
 10	       D = [Select Name,Id,Account__c,Account__r.Name,Rate__c,License_Value__c,Account__r.BillingStreet,Account__r.BillingCity,Account__r.Billingstate,Account__r.BillingPostalcode,Account__r.BillingCountry
 11	                   from Deal__c where id=:controller.getRecord().id];
 12	      system.debug('TestDeal'+D);
 13	      Account acc=[Select Id,BillingStreet,BillingCity,Billingstate,BillingPostalcode,BillingCountry from Account where id=:D.Account__c];
 14	      system.debug('Account%%%%%%%%%%%%%%'+acc);
 15	      dp=[select id,Name,Deal__c,Months__c,List_Price__c,Unit_Price__c,Quantity__c,Total_Value__c from Deal_License__c where Deal__c=:D.Id];
 16	      System.debug('DEALPRDODUCT&&&&&&&&&&'+dp);
 17	      }
 18	      catch(Exception e)
 19	      {
 20	      system.debug('Exception'+e);
 21	      }
 22	      }
 23	      
 24	      public void attach() {
 25	          try{
 26	              Attachment myAttach = new Attachment();
 27	              myAttach.ParentId = ApexPages.currentPage().getParameters().get('id');
 28	              System.debug('Id: ' + ApexPages.currentPage().getParameters().get('id'));
 29	              List<Attachment> at=[Select id from Attachment where parentId=:myAttach.ParentId];
 30	              Integer c=at.size()+1;
 31	              myAttach.name =D.Account__r.Name +''+ 'License Version' + c +'.pdf';
 32	              PageReference psPdf = new PageReference('/apex/Quotation?id=' + ApexPages.currentPage().getParameters().get('id'));
 33	              myAttach.body = psPdf.getContentAsPdf();
 34	  
 35	              insert myAttach;
 36	              
 37	                
 38	              
 39	                         
 40	              System.debug('After attach');
 41	              System.debug(myAttach);
 42	  
 43	              
 44	              /*
 45	              ApexPages.addMessage(new ApexPages.Message
 46	  
 47	  (ApexPages.Severity.CONFIRM,'Quotation has been attached.'));
 48	              */
 49	          }
 50	          catch(Exception e) {
 51	              ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL,'There was an error while attaching'));
 52	              System.debug('Exception');
 53	          }
 54	      }
 55	      
 56	     public PageReference QA() {
 57	     
 58	       PageReference secondPage = new PageReference('/apex/EmailQuote?id=' + ApexPages.currentPage().getParameters().get('id'));
 59	  
 60	        Attachment myAttach = new Attachment();
 61	              myAttach.ParentId = ApexPages.currentPage().getParameters().get('id');
 62	              System.debug('Id: ' + ApexPages.currentPage().getParameters().get('id'));
 63	              List<Attachment> at=[Select id from Attachment where parentId=:myAttach.ParentId];
 64	              Integer c=at.size()+1;
 65	              myAttach.name = D.Account__r.Name +''+ 'License Version' + c +'.pdf';
 66	              PageReference psPdf = new PageReference('/apex/Quotation?id=' + ApexPages.currentPage().getParameters().get('id'));
 67	              myAttach.body = psPdf.getContentAsPdf();
 68	  
 69	              //insert myAttach;
 70	                
 71	              secondPage.setRedirect(true);   
 72	              return secondPage; 
 73	              
 74	      }
 75	      public PageReference back() {
 76	          attach();
 77	          PageReference pr = new PageReference('/' + ApexPages.currentPage().getParameters().get('id') +'#'+ ApexPages.currentPage().getParameters().get('id') + '_RelatedNoteList_target');
 78	          pr.setRedirect(true);
 79	          System.debug('Inside back');
 80	          return pr;
 81	      }
 82	         public PageReference cancel() {
 83	         PageReference pr = new PageReference('/' + ApexPages.currentPage().getParameters().get('id') +'#'+ ApexPages.currentPage().getParameters().get('id') + '_RelatedNoteList_target');
 84	         pr.setRedirect(true);
 85	         System.debug('Inside back');
 86	         return pr;
 87	         }
 88	         
 89	      
 90	        
 91	       /*public String attachmentName{get; set;}
 92	        public pagereference AttachQuote(){
 93	          Pagereference pdf = page.Quotation;
 94	          blob  b=pdf.getcontent();
 95	        
 96	           attachment att = new attachment();
 97	           att.parentId = ApexPages.currentPage().getParameters().get('id') ;
 98	           att.body = b;
 99	           att.name = 'Quotation.pdf';     
 100	           insert att;
 101	           return null;
 102	           
 103	           
 104	        
 105	        }*/
 106	         /*test methods here*/
 107	       public  static testMethod void testAttachController()
 108	        {    
 109	         Profile p = [SELECT Id FROM Profile WHERE Name='Standard User']; 
 110	    
 111	   User U = new User(Alias = 'TUser1', Email='testItemaster1@im.com',EmailEncodingKey='UTF-8',
 112	     LastName='TestingAcc1', LanguageLocaleKey='en_US',LocaleSidKey='en_US', ProfileId =p.Id,
 113	     TimeZoneSidKey='America/Los_Angeles', UserName='testacc1@test.com');   
 114	   insert U;
 115	          
 116	          Account acc=new Account
 117	  
 118	  (Name='rose',BillingCity='bang',Billingstate='kat',BillingPostalcode='560000',BillingCountry='india');
 119	          insert acc;
 120	           system.debug('########555'+ acc);
 121	          Deal__c opp=new Deal__c(Name='test12',Account__c=acc.id);
 122	          insert opp;
 123	          system.debug('########7765'+ opp);
 124	       
 125	                  
 126	          Attachment myAttach1 = new Attachment();
 127	          myAttach1.ParentId =opp.id;
 128	          myAttach1.name = 'Quotation.pdf';
 129	          myAttach1.body = blob.valueof('test');
 130	            
 131	          insert myAttach1;
 132	          
 133	          
 134	          system.debug('Attahment1'+ myAttach1);
 135	       
 136	          AttachController atc = new AttachController(new ApexPages.StandardController(opp));
 137	          system.debug('%%%%%'+atc);
 138	          PageReference pageRef = Page.Quotation;
 139	          pageRef.getParameters().put('id', String.valueOf(opp.Id));
 140	          Test.setCurrentPage(pageRef);
 141	         Blob b;
 142	  
 143	  
 144	         AttachController atc1 = new AttachController(new ApexPages.StandardController(myAttach1));
 145	          
 146	          atc1.attach();
 147	          atc.back();
 148	          atc.cancel();
 149	          //atc.QA();
 150	         
 151	          
 152	          return;
 153	         /* public PageReference QA() {
 154	       PageReference secondPage = new PageReference('/apex/EmailQuote?id=' + 
 155	  
 156	  ApexPages.currentPage().getParameters().get('id'));
 157	          
 158	         insert myAttach1;
 159	         secondPage.setRedirect(true);   
 160	              return secondPage;
 161	              }*/
 162	       
 163	        //Attachment atchoo = [Select Id,  From Attachment where Name like 'Quotation.pdf' 
 164	  
 165	  
 166	         /* if (Test.isRunningTest())
 167	  {
 168	     b=Blob.valueOf('Test Blob String');
 169	  }
 170	  else
 171	  {
 172	    b= pageRef.getContent();
 173	  }*/
 174	  
 175	           }
 176	           
 177	        }

 when i am trying to keep atc.QA();

Error message:Methods defined as TestMethod do not support getContent call, test skipped

 

 

can u pls anybody help in solving this