• Sandra Wicket
  • NEWBIE
  • 165 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 25
    Questions
  • 52
    Replies
Hey Guys,

i want to create a simple list of task ordered by the last modified date of the parent record. It is no problem to the the account last modified date but i am unable to catch the last modified date of the lead object. It would be ok to seperate  it in to lists. 

Any solution for this ? 

Thanks for your help guys ! 
Hey Guys, 

i have created a visualforce page which overrides the standard edit page.  The Controller defines which record type is linked to another visualforce page. That works fine, but for some record types i want use the standard edit page. Here is the controller :
 
public PageReference redirect(){
        IF(ev.Recordtype.Name.equals('A')){
           rPage = Page.A;
               } else if(ev.Recordtype.Name.equals('B') ) {
                   rPage = Page.B;
               }else if(ev.Recordtype.Name.equals('C')){
                   rPage = Page.C;   
               }
        		else if(ev.Recordtype.Name.equals('D')){
                   rPage = Page.D;   
                }
        
        		else if(ev.Recordtype.Name.equals('E')){
                   rPage = Page.E;   
               }
        		
        else {
            rPage = Page.Event_StandardEditPage;     // Here i want the standard edit page 
        }
        return rPage;
Greetings Sandra


 
Hey guys,

is it possible to redirect (or open a new tab) to the task edit page after the master record is updated ? 

Greetings , 

Sandra
Hi there,

the apex:column component is calling a text area field. Is there a way to remove the hyperlinks or at least change the color of the links ? 
Thanks for your help guys. 

Greetings Sandra
Hello guys,

I have 2 visualforce pages and 1 apex controller extension for both. On the first page I capture some information that is displayed on the second page (renderAs PDF).  On the first page, one Button is using this simple methode to open the second page.
public PageReference quotePage(){     
        PageReference qPage = Page.quote2;        	
        
return qPage;
}

There is no problem showing a pdf preview, but the chrome download function is not working. Chrome is not able to recognize the pdf format in the save option. I have already deleted my cookies but the error still appears.  Firefox works fine, but it is important for us to do it with google chrome.  

If i open the pdf page directly it is not a problem for chrome to download it..So the problem should be the controller methode. 

Thanks for your help guys ! i hope there is a simple solution for that.


Cheers,

Sandra W 
Hey Guys, 

is it possible to append a visualforce page to another one ? One page is just a text file. To reduce the lines of Code of the "real" visualforce page, i am looking for a way to merge these two pages. Is there a simple way to do this ? 

Greetings,
Sandra
Hello guys, 
i created a controller with following methodes. I have 96% code coverage and want to deploy my controller..

- m1 - returns a list of a wrapper class object1
- m2 - returns a list of a wrapper class object2
- m3 - creates records with values releated to m1 & m2 

So, i have created for each methode more test methodes in my test class.

for m1: 
- positive -- the list returns some records
- null - the list doesen't return some recrods
- bulk - the list shows 100 records 

for m2: 
- positive -- the list returns some records
- null - the list doesen't return some recrods
- bulk - the list shows 100 records 

for m3:
- positiv - the methode creates one record
- Null - the methode creates no record
- bulk - the methode creates 100 records

i have checked each methode with system.assertEquals.

Now, my question(s).
- is this a good strategy for my test class ?
- i have created new test data for each test methode --- is this necessary ? 
- my test class has more than 300 lines -- is this too much ? 

thanks for your time. I really want to learn how to write good test classes.


Sandra 



 
Hello guys,

i am unable to cover a opportunityLineItem formula field "product_family__c " (Formula=TEXT(PricebookEntry.Product2.Family))
in my test class. I queried the field in my controller like this : 
public List <oppProduct> getOli (){
        if(productList ==null){
            productList = new List <oppProduct>();
            for(OpportunityLineitem oli : 
                [select Id, Quantity, Produkt__c, UnitPrice , ON_product_family__c, Product2.Name, ON_Produktbeschreibung_detailliert__c From OpportunityLineitem 
                        WHERE Opportunity.Id = :opportunityId
                        AND ON_product_family__c = 'Extra Boost']){
                productList.add(new oppProduct(oli));   
        
            }   
        }
        return productList; 
    }
In my test class i created the necessary test data, but the value is always Null in the bold system.assertEquals statement
@isTest static void testGetOli () {
        
        List<CreateMultiExtraBoost.oppProduct> productListTest = new List <CreateMultiExtraBoost.oppProduct>();         
        Id pricebookId = Test.getStandardPricebookId();

        Product2 pro = new Product2();
        pro.name = 'test';
        pro.Produktbeschreibung_detailliert__c = 'test';
        pro.Family = 'Extra Boost'; 
        pro.IsActive = true;
        insert pro;
// 
        system.assertEquals('Extra Boost', pro.Family ); 

        
        Product2 pro1 = new Product2();
        pro1.name = 'test';
        pro1.Produktbeschreibung_detailliert__c = 'test';
        pro1.Family = 'Sonstiges'; 
        pro1.IsActive = true;
        insert pro1;
        system.assertEquals('Sonstiges', pro1.Family );

        
        PricebookEntry pEntry = new PricebookEntry (); 
        pEntry.Product2Id = pro.id;
        pEntry.UseStandardPrice = false;
        pEntry.UnitPrice = 600; 
        pEntry.Pricebook2Id = pricebookId;
        pEntry.IsActive = true;
        insert pEntry; 
        system.assertEquals(pro.id, pEntry.Product2Id);

              
        List<Product2> p = [Select Family FROM Product2 WHERE isActive=true];
        List<PricebookEntry> pe = [Select Product2.Family FROM PricebookEntry];

        system.assertEquals('01sD0000000hbEh', pEntry.Pricebook2Id );
        system.assertEquals('Extra Boost', pEntry.Product2.Family);

          
        PricebookEntry pEntry1 = new PricebookEntry (); 
        pEntry1.Product2Id = pro1.id;
        pEntry1.UseStandardPrice = false;
        pEntry1.UnitPrice = 300; 
        pEntry1.Pricebook2Id = pricebookId;
        pEntry1.IsActive = true;
        insert pEntry1;   

        
        Opportunity opp = new Opportunity ();
        opp.name = 'test';
        opp.StageName = '40 - Demo Termin vereinbart';
        opp.Override_Region__c = 'München';
        opp.CloseDate = System.today();
        insert opp;
        
        OpportunityLineItem oli = new OpportunityLineItem ();
        oli.TotalPrice = 500;
        oli.Quantity = 4;
        oli.OpportunityId = opp.Id;
        oli.Product2Id = pro.id;
        oli.ON_Produktbeschreibung_detailliert__c = 'test';                            
        oli.PricebookEntryId = pEntry.id;
        insert oli;
           
        system.assertEquals(4,oli.Quantity );
        system.assertEquals(pro.id,oli.Product2Id );
        system.assertEquals(pEntry.id,oli.PricebookEntryId );
        system.assertEquals(opp.Id,oli.OpportunityId );
        system.assertEquals('Extra Boost', oli.ON_product_family__c);
        
        OpportunityLineItem oli1 = new OpportunityLineItem ();
        oli1.TotalPrice = 500;
        oli1.Quantity = 4;
        oli1.OpportunityId = opp.Id;
        oli1.ON_Produktbeschreibung_detailliert__c = 'test';
        oli1.Product2Id = pro1.id;
        oli1.PricebookEntryId = pEntry1.id;
        insert oli1; 
        
        update opp;
        
        
                     
        CreateMultiExtraBoost cme = new CreateMultiExtraBoost();
        
        if (productListTest == Null){
            for(OpportunityLineitem olip : 
                    [select Id, Quantity, Produkt__c, UnitPrice , ON_product_family__c, Product2.Name, ON_Produktbeschreibung_detailliert__c From OpportunityLineitem 
                            WHERE Opportunity.Id = :opp.Id
                            AND ON_product_family__c = 'Extra Boost']){
                            productListTest.add(new CreateMultiExtraBoost.oppProduct(olip)); 
                            }    
               
        }                       
        
                cme.getOli();
                                  
    }
I inserted the records and queried them, but unfortunately it doesen't work. 
Thanks for your time and your help! 

cheers, 

Sandra
Hi there,

i want to test following methode: 
public List <oppProduct> getOli (){
        if(productList ==null){
            productList = new List <oppProduct>();
            for(OpportunityLineitem oli : 
                [select Id, Quantity, Produkt__c, UnitPrice , product_family__c, Product2.Name, ON_Produktbeschreibung_detailliert__c From OpportunityLineitem 
                        WHERE Opportunity.Id = :opportunityId
                        AND product_family__c = 'Extra Boost']){
                productList.add(new oppProduct(oli));   
        
            }   
        }
        return productList; 
    }

    
In my test class i created these test records :

 @isTest static void testGetOli () {
        
        List<CreateMultiExtraBoost.oppProduct> productListTest = new List <CreateMultiExtraBoost.oppProduct>(); 
 
        Id pricebookId = Test.getStandardPricebookId();
        
        Product2 pro = new Product2();
        pro.name = 'test';
        pro.Produktbeschreibung_detailliert__c = 'test';
        pro.Family = 'Extra Boost'; 
        pro.IsActive = true;
        insert pro;
        
        Product2 pro1 = new Product2();
        pro1.name = 'test';
        pro1.Produktbeschreibung_detailliert__c = 'test';
        pro1.Family = 'Sonstiges'; 
        pro1.IsActive = true;
        insert pro1;
        
        PricebookEntry pEntry = new PricebookEntry (); 
        pEntry.Product2Id = pro.id;
        pEntry.UseStandardPrice = false;
        pEntry.UnitPrice = 600; 
        pEntry.Pricebook2Id = pricebookId;
        pEntry.IsActive = true;
        insert pEntry;
        
        PricebookEntry pEntry1 = new PricebookEntry (); 
        pEntry1.Product2Id = pro1.id;
        pEntry1.UseStandardPrice = false;
        pEntry1.UnitPrice = 300; 
        pEntry1.Pricebook2Id = pricebookId;
        pEntry1.IsActive = true;
        insert pEntry1;
        
        Opportunity opp = new Opportunity ();
        opp.name = 'test';
        opp.StageName = '40 - Demo Termin vereinbart';
        opp.Override_Region__c = 'München';
        opp.CloseDate = System.today();
        insert opp;
        
           OpportunityLineItem oli = new OpportunityLineItem ();
        oli.TotalPrice = 500;
        oli.Quantity = 4;
        oli.OpportunityId = opp.Id;
        oli.Product2Id = pro.id;
        oli.PricebookEntryId = pEntry.id;
        insert oli;
        
        OpportunityLineItem oli1 = new OpportunityLineItem ();
        oli1.TotalPrice = 500;
        oli1.Quantity = 4;
        oli1.OpportunityId = opp.Id;
        oli1.Product2Id = pro1.id;
        oli1.PricebookEntryId = pEntry1.id;
        insert oli1;
        
        Test.StartTest();
        CreateMultiExtraBoost cme = new CreateMultiExtraBoost();
        cme.getOli();
        Test.StopTest();

i am unable to cover the product_family__c field. It is a formula field, which is related to the product object. Thanks for your help guys ! 
 
Hello guys, 

this apex class includes one wrapper class (cBoost). With the cBoost object and a visualforce page the user is able to select Finalboost records. After the user selection, the class generates XtraBoostOpp__c records. Now, i want to provide a option for the user to create a integer value for each selected FinalBoost record. In the save methode i want to create the XtraBoostOpp__c records and assign the integer value.

In my opinion, i have to create a new variable in my wrapper class (cBoost.menge) . I have tried different ways but nothing worked....
The api name of the XtraBoostOpp__c field is 'Menge__c' .  
public class CreateMultiExtraBoost {

	public List<cBoost> boostList {get; set;}
    public Id opportunityId {get;set;}
        
    // Constructor 
    public CreateMultiExtraBoost (){
    	opportunityId =  ApexPages.currentPage().getparameters().get('oppId');
    }

	//Methode
	public List<cBoost> getBoosts() { 
		if(boostList == null) {
			boostList = new List<cBoost>();
			for(FinalBoost__c fb: [select Id, Name from FinalBoost__c ]) {
				boostList.add(new cBoost(fb));

			}
		}
		return boostList;
	}

	public PageReference save() {
       
		List<FinalBoost__c> selectedBoosts = new List <FinalBoost__c>();
        List<XtraBoostOpp__c> boostItems = new List <XtraBoostOpp__c>(); 
        pagereference oppPage = new pagereference('/' + opportunityId);
    
		for(cBoost cbInList: getBoosts ()) {
			if(cbInList.selected == true ) {
				selectedBoosts.add(cbInList.fbo);
			}
		}

		System.debug('These are the selected ...');
		for(FinalBoost__c con: selectedBoosts) {
			system.debug(con);
		}
        
        for (FinalBoost__c fboInList: selectedBoosts) {
            	
            	XtraBoostOpp__c boost = new XtraBoostOpp__c ();
            	boost.FinalBoost__c = fboInList.Id;
            	boost.Opportunity__c = opportunityId;
            	boost.Menge__c = //user input variable 
				boostItems.add(boost);
    
       }
        insert boostItems;
        return oppPage;
	}
    
   
   // WrapperClass
	public class cBoost {
		public FinalBoost__c fbo {get; set;}
		public Boolean selected {get; set;}
        public Integer menge {get; set;} // user input variable 

		//WrapperClass Constructor 
      public cBoost(FinalBoost__c f) {
			this.fbo = f;
			this.selected = false;
          	this.menge = 0;
      }
	}
}

Thanks for your help guys ! 
 
Hi Guys,

this is my code :
public class CreateMultiExtraBoost {

	public List<cBoost> boostList {get; set;}
    Integer listSize {get;set;}
    public Id opportunityId {get;set;}
    public ID finalBoostId {get; set;}
        
    // Constructor 
    public CreateMultiExtraBoost (){
    	opportunityId =  ApexPages.currentPage().getparameters().get('oppId');
    }

	//Methode
	public List<cBoost> getBoosts() {
		if(boostList == null) {
			boostList = new List<cBoost>();
			for(FinalBoost__c c: [select Id, Name from FinalBoost__c ]) {
				boostList.add(new cBoost(c));
			}
		}
		return boostList;
	}

	public PageReference save() {
 
		List<FinalBoost__c> selectedContacts = new List <FinalBoost__c>();
        List<BoostOpp__c> boostItems = new List <BoostOpp__c>(); 
        pagereference oppPage = new pagereference('/' + opportunityId);

		for(cBoost cCon: getBoosts ()) {
			if(cCon.selected == true ) {
				selectedContacts.add(cCon.con);
			}
		}

		System.debug('These are the selected ...');
		for(FinalBoost__c con: selectedContacts) {
			system.debug(con);
		}
        
        for (FinalBoost__c con: selectedContacts) {
            	boostItems.add(new BoostOpp__c());
            	finalBoostId = con.Id;
            
            		for(BoostOpp__c boostIteminList : boostItems) {
                        boostIteminList.Opportunity__c = opportunityId;
                        boostIteminList.FinalBoost__c = finalBoostId;
       	 }
       }
        insert boostItems;
        return oppPage;
	}
    
   
   // WrapperClass
	public class cBoost {
		public FinalBoost__c con {get; set;}
		public Boolean selected {get; set;}

		// Constructor 
        public cBoost(FinalBoost__c c) {
			con = c;
			selected = false;
		}
	}
}

A visualforcepage shows the table of FinalBoost records. I can select records and use them in the save methode.  The BoostOpp__c object is a junction object. It is related to the opportunity and the FinalBoost Object. 

In my loop, i want to create for each selected record one child record and assign the parent id (FinalBoost) to the masterDetail field. At the moment, it creates for each selection one record but allways with the same finalBoostId.  Is there a simple solution for that ? 


Cheers Sandra
Hello Guys,

i have created a simple custom controller to create multipe junction records.  The master object ist the opportunity object. Here is my Code

public class AddingBoostsController {

    public List<BoostOpp__c > BoostList {get;set;}
    public Integer rowNum{get;set;}

    public AddingBoostsController(){
        BoostList = new List<BoostOpp__c>();  
        BoostList.add(new BoostOpp__c()); 
            
    }
    
    public void insertBoost(){
        insert BoostList; 
    }
 
    public void insertRow(){
        BoostList.add(new BoostOpp__c()); 
    }
    
    
    public void delRow(){
        rowNum = Integer.valueOf(apexpages.currentpage().getparameters().get('index'));
        BoostList.remove(rowNum);   
    }
}

A Javascript Button is calling the visualforce Page.  Now, i am looking for a solution to get the record id of the opportunity record to 

1. assign it each record in the list 
2. return to the master record, after the list is inserted 

Is there a way to use a javascript variable in the apex code ? 


Greetings Sandra
 
Hi there, 
i installed the Survey Force App from the appexchange market. Because the app is not supported i want to unterstand  the "main Code" and the basics. I cant find the standard controller "survey__c". I didnt know that for each custom object is automatically created a standard controller.  Is there a way to view the standardcontroller ?  

Thanks for your help !
Hi experts, 
i created a simple survey with the visual flow editor. I also created a Force.com site to make the flow accessible for guest users. The plan is, to create a nps for our customers.

The first part works fine. I can create custom object records on my website.  The more tricky part is to connect the record to the contact or account. I can create a text field on the survey screen to get the email adress or the company name but i am looking for a automated way. I am afraid that there is no solution to get the account id or contact id on the survey.  

Thanks for your help ! 
Hi there, 
is it possoble to update the Account Type after an Email Message is sent ?  It tried the process builder, but it did not work. The Email is related to the Account. Thanks for your help guys ! ;)  
Hi guys,
 
i created this custom controller for a visualforce page.  It shows all leads of the user with high priority.  The user is able to filter Leads by the Industry. The new variable industryPickvalue is just to select "all" Leads. It works fine for me in the sandbox, but i am not able to deploy it.  I am not a developer but it would be great to hear some solutions or ideas.

public class LeadPageControllerFilter {
    public string industryPickvalue{get; set;}
    public list<lead> leadList{get; set;}
     
    public void getLeads() {
        
        if (industryPickvalue == 'All'){

        leadList = new list<lead>([SELECT Id, Name, Company, Owner.name , Status, Industry, Lead_ScoreFinal__c from Lead  
        WHERE 
            OwnerId = :UserInfo.getUserId() 
            AND Time_LastModified__c != TODAY 
            AND Status != 'TEST'
            
        ORDER BY 
            Lead_ScoreFinal__c DESC       
        LIMIT 10]);
        
        } else {
        
        leadList = new list<lead>([SELECT Id, Name, Company, Owner.name , Status, Industry, Lead_ScoreFinal__c from Lead 
        WHERE 
              OwnerId = :UserInfo.getUserId() 
              AND Industry = :industryPickvalue 
              AND Time_LastModified__c != TODAY  
              AND Status != '40 - Demo Termin vereinbart'
                  
        ORDER BY 
            Lead_ScoreFinal__c DESC       
        LIMIT 10]);
        }      
    }
}


Testclass : 
@isTest 
public class LeadPageControllerFilterTest
{
    static testMethod void testMethod1() 
    {
        // create a Lead
        Lead lead=new Lead(
        LastName='Doe', 
        FirstName='John', 
        Company = 'Test', 
        Status = 'test' ,
        Country = 'Deutschland', 
        LeadSource = 'Import',
        PostalCode = '83024',
        Phone = '0300340340',
        Industry = 'Sonstige Branche' );
        
        insert lead;   

        Test.StartTest();

            LeadPageControllerFilter obj = new LeadPageControllerFilter();
           
            obj.industryPickvalue ='All';
            obj.getLeads();        
            obj.industryPickvalue ='Sonstige Branche';
            obj.getLeads();
           
        Test.StopTest();        
        
    }
}

The problem is the variable "industryPickvalue". I need the testclass for this controller, but i can't deploy it, because the variable "industryPickvalue" doesen't exist in the production. Maybe i have to deploy the varibale separately ?  Or maybe i can create the filter "all" with the visualforce page ?  Thanks for your help and your time ! 

 
Hi there, 
i created the trigger below.. I got one problem. Everytime the trigger create two Cases, but i dont know why ^^ Could you help me pls ?  Thanks for your help guys ! 

trigger createCaseafterAccountv2 on ACCOUNT(after update)
{
    List<CASE> caToInsert = new List<CASE>();
    for(ACCOUNT acc : Trigger.new)
    {
    if(acc.Vertragsbeginnro__c == System.Today () && acc.RecordTypeID == '03r03rxxxxxxxxxxx'|| Test.isRunningTest() )
    {
            if( ( acc.Vertragsbeginnro__c != Trigger.oldMap.get(Acc.id).Vertragsbeginnro__c) || Test.isRunningTest() )
            {
                 CASE cas = new CASE(AccountID=acc.id);
                 cas.subject = 'Test';
                 cas.origin = 'test';
                 cas.Status = 'in Bearbeitung';
                 cas.betreut_von__c = 'Walter White';
                 cas.Wiedervorlage_am__C = acc.Vertragsendero__c.addDays(-120);
                 
                 caToInsert.add(cas);
            }
            }
    }
    try{
    insert caToInsert;
    
    }
    catch(system.Dmlexception e){
    system.debug(e);
    }
}
Hi there, 
i want to upload my testclass or a new Trigger. Everytime i want to validate the testclas, i get this error message :

System.AssertException: Assertion Failed: Expected: 01sD0000000xxxxx, Actual: null 

The ID is a pricebook. Any advise ?  Thanks for your help guys.  The Code blow is my testclass 


@isTest
public class UpdateLorAccRelatedtoTaskTest 
{
    static testMethod void testMethod1()
    {        
        Lead l = new Lead();
     
        l.LastName = 'Batman';
        l.LeadSource = 'Import';
        l.company ='Batman GmbH';
        l.country ='Deutschland';
        l.Status = 'qualified';
        l.PostalCode ='00000';
        l.Phone ='003030';
        l.LeadSource = 'Import';
        l.Time_Task__c = Date.valueOf('2013-05-05');
        
        insert l;
        

        Task t = new Task();
        
        t.whoId = l.Id;
        t.Subject='Demotermin';  
        t.Status = 'Nicht Begonnen';
        t.priority = 'Normal';
        t.ActivityDate = Date.valueOf('2013-05-06');
        
        insert t; 
        t.Subject='Demotermin1';
        t.ActivityDate = Date.valueOf('2013-05-07');
      
        update t;
        
        
        Account acc = new Account();
        
        acc.name = 'Test';
        acc.billingCountry = 'Deutschland';
        acc.billingPostalCode = '00000';
        acc.Type = 'Interessent';
        acc.Leadquelle__c = 'Import';
        acc.Time_Task__c = Date.valueOf('2013-06-05');
        
        insert acc;
        
        Task tt = new Task ();
        tt.whatId = acc.Id;
        tt.Subject='Demotermin';
        tt.Status = 'Nicht Begonnen';
        tt.priority = 'Normal';
        tt.ActivityDate = Date.valueOf('2013-05-07');
        
        insert tt;
        
        tt.Subject = 'Demotermin2';
        tt.ActivityDate = Date.valueOf('2013-07-07');
        
        update tt;       
    }
}
Hi there, 
i create the code blow by copy paste different triggers and add some conditions. The Code works fine for me, but i dont unterstand all lines . 

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

 List<Id> LeadIds = new List<Id>();
 List<Lead> LeadList = new List<Lead>();

for(Task t :trigger.new)
    {
    if(t.whoId!=null)
    {
        Schema.SObjectType tType= t.whoId.getSObjectType();
        if(tType == Lead.Schema.SObjectType)
        {
            LeadIds.add(t.WhoId);
        }
    }
    }
    //Querying the related Lead based on whoId on Task
    Map<Id,Lead> LeadMap =  new Map<Id,Lead>([select id,Time_Task__c from Lead where id in:LeadIds]);
     
    for(Task t :Trigger.new)
 
        for(Lead l : LeadMap.Values())
        {
        if(t.ActivityDate > l.Time_Task__c)
         {
            l.Time_Task__c = t.ActivityDate;
            LeadList.add(l); 
           }
        }  
        
         if(LeadList.size()>0)
        {
          update LeadList;    
          }  
 }

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

Update LeadList; -- Do i need the if condition ? in my opinion , nope 

------------------------------------------------------------------------------------
This part is like a black box ^^ I check if the task is related to the Lead, right ? 

  Schema.SObjectType tType= t.whoId.getSObjectType();
        if(tType == Lead.Schema.SObjectType)
        {
            LeadIds.add(t.WhoId);


A short description would great. Thanks for your help guys ! 
Hey there, 
i create this custom controller for my Visualforce Page. The controller works fine, but i dont anything about test classes (shame on me).. Could you help me please ? 


public class LeadPageControllerFilter {
    public string industryPickvalue{get; set;}
    public list<lead> leadList{get; set;}
    

    
    public void getLeads() {
        
        if (industryPickvalue == 'All'){

        leadList = new list<lead>([SELECT Id, Name, Company, Owner.name , Status, Industry, Lead_Score__c from Lead  
        WHERE 
            OwnerId = :UserInfo.getUserId() AND LastModifiedDate != TODAY 
        ORDER BY 
            Lead_Score__c DESC       
        LIMIT 10]);
        
        } else {
        
        leadList = new list<lead>([SELECT Id, Name, Company, Owner.name , Status, Industry, Lead_Score__c from Lead 
        WHERE 
              OwnerId = :UserInfo.getUserId() AND 
              Industry = :industryPickvalue  AND
              LastModifiedDate != TODAY  
                  
        ORDER BY 
            Lead_Score__c DESC       
        LIMIT 10]);
        }      
    }
}
Hello guys,

I have 2 visualforce pages and 1 apex controller extension for both. On the first page I capture some information that is displayed on the second page (renderAs PDF).  On the first page, one Button is using this simple methode to open the second page.
public PageReference quotePage(){     
        PageReference qPage = Page.quote2;        	
        
return qPage;
}

There is no problem showing a pdf preview, but the chrome download function is not working. Chrome is not able to recognize the pdf format in the save option. I have already deleted my cookies but the error still appears.  Firefox works fine, but it is important for us to do it with google chrome.  

If i open the pdf page directly it is not a problem for chrome to download it..So the problem should be the controller methode. 

Thanks for your help guys ! i hope there is a simple solution for that.


Cheers,

Sandra W 
Hi Guys,

this is my code :
public class CreateMultiExtraBoost {

	public List<cBoost> boostList {get; set;}
    Integer listSize {get;set;}
    public Id opportunityId {get;set;}
    public ID finalBoostId {get; set;}
        
    // Constructor 
    public CreateMultiExtraBoost (){
    	opportunityId =  ApexPages.currentPage().getparameters().get('oppId');
    }

	//Methode
	public List<cBoost> getBoosts() {
		if(boostList == null) {
			boostList = new List<cBoost>();
			for(FinalBoost__c c: [select Id, Name from FinalBoost__c ]) {
				boostList.add(new cBoost(c));
			}
		}
		return boostList;
	}

	public PageReference save() {
 
		List<FinalBoost__c> selectedContacts = new List <FinalBoost__c>();
        List<BoostOpp__c> boostItems = new List <BoostOpp__c>(); 
        pagereference oppPage = new pagereference('/' + opportunityId);

		for(cBoost cCon: getBoosts ()) {
			if(cCon.selected == true ) {
				selectedContacts.add(cCon.con);
			}
		}

		System.debug('These are the selected ...');
		for(FinalBoost__c con: selectedContacts) {
			system.debug(con);
		}
        
        for (FinalBoost__c con: selectedContacts) {
            	boostItems.add(new BoostOpp__c());
            	finalBoostId = con.Id;
            
            		for(BoostOpp__c boostIteminList : boostItems) {
                        boostIteminList.Opportunity__c = opportunityId;
                        boostIteminList.FinalBoost__c = finalBoostId;
       	 }
       }
        insert boostItems;
        return oppPage;
	}
    
   
   // WrapperClass
	public class cBoost {
		public FinalBoost__c con {get; set;}
		public Boolean selected {get; set;}

		// Constructor 
        public cBoost(FinalBoost__c c) {
			con = c;
			selected = false;
		}
	}
}

A visualforcepage shows the table of FinalBoost records. I can select records and use them in the save methode.  The BoostOpp__c object is a junction object. It is related to the opportunity and the FinalBoost Object. 

In my loop, i want to create for each selected record one child record and assign the parent id (FinalBoost) to the masterDetail field. At the moment, it creates for each selection one record but allways with the same finalBoostId.  Is there a simple solution for that ? 


Cheers Sandra
Hello Guys,  i hope somebody can help me ;) I wrote this trigger ( i am a new "developer"^^). Now i need a Test Class for this Trigger to run in our Production. I have no idea how to start :( Maybe its easy but for me .. so pleas help me guys :)

User-added image
Hey Guys,

i want to create a simple list of task ordered by the last modified date of the parent record. It is no problem to the the account last modified date but i am unable to catch the last modified date of the lead object. It would be ok to seperate  it in to lists. 

Any solution for this ? 

Thanks for your help guys ! 
Hey Guys, 

i have created a visualforce page which overrides the standard edit page.  The Controller defines which record type is linked to another visualforce page. That works fine, but for some record types i want use the standard edit page. Here is the controller :
 
public PageReference redirect(){
        IF(ev.Recordtype.Name.equals('A')){
           rPage = Page.A;
               } else if(ev.Recordtype.Name.equals('B') ) {
                   rPage = Page.B;
               }else if(ev.Recordtype.Name.equals('C')){
                   rPage = Page.C;   
               }
        		else if(ev.Recordtype.Name.equals('D')){
                   rPage = Page.D;   
                }
        
        		else if(ev.Recordtype.Name.equals('E')){
                   rPage = Page.E;   
               }
        		
        else {
            rPage = Page.Event_StandardEditPage;     // Here i want the standard edit page 
        }
        return rPage;
Greetings Sandra


 
Hey guys,

is it possible to redirect (or open a new tab) to the task edit page after the master record is updated ? 

Greetings , 

Sandra
Hi there,

the apex:column component is calling a text area field. Is there a way to remove the hyperlinks or at least change the color of the links ? 
Thanks for your help guys. 

Greetings Sandra
Hello guys,

I have 2 visualforce pages and 1 apex controller extension for both. On the first page I capture some information that is displayed on the second page (renderAs PDF).  On the first page, one Button is using this simple methode to open the second page.
public PageReference quotePage(){     
        PageReference qPage = Page.quote2;        	
        
return qPage;
}

There is no problem showing a pdf preview, but the chrome download function is not working. Chrome is not able to recognize the pdf format in the save option. I have already deleted my cookies but the error still appears.  Firefox works fine, but it is important for us to do it with google chrome.  

If i open the pdf page directly it is not a problem for chrome to download it..So the problem should be the controller methode. 

Thanks for your help guys ! i hope there is a simple solution for that.


Cheers,

Sandra W 
Hello guys, 
i created a controller with following methodes. I have 96% code coverage and want to deploy my controller..

- m1 - returns a list of a wrapper class object1
- m2 - returns a list of a wrapper class object2
- m3 - creates records with values releated to m1 & m2 

So, i have created for each methode more test methodes in my test class.

for m1: 
- positive -- the list returns some records
- null - the list doesen't return some recrods
- bulk - the list shows 100 records 

for m2: 
- positive -- the list returns some records
- null - the list doesen't return some recrods
- bulk - the list shows 100 records 

for m3:
- positiv - the methode creates one record
- Null - the methode creates no record
- bulk - the methode creates 100 records

i have checked each methode with system.assertEquals.

Now, my question(s).
- is this a good strategy for my test class ?
- i have created new test data for each test methode --- is this necessary ? 
- my test class has more than 300 lines -- is this too much ? 

thanks for your time. I really want to learn how to write good test classes.


Sandra 



 
Hi,
I want to know is it possible to use where clause in SOQL query on the data type. Example if I have A custom object and within that, I have 4 checkbox fields. and I want to query only those checkboxes which are true. And moreover, can we get field label from SOQL query.

So is it possible through SOQL query?
Hi there,

i want to test following methode: 
public List <oppProduct> getOli (){
        if(productList ==null){
            productList = new List <oppProduct>();
            for(OpportunityLineitem oli : 
                [select Id, Quantity, Produkt__c, UnitPrice , product_family__c, Product2.Name, ON_Produktbeschreibung_detailliert__c From OpportunityLineitem 
                        WHERE Opportunity.Id = :opportunityId
                        AND product_family__c = 'Extra Boost']){
                productList.add(new oppProduct(oli));   
        
            }   
        }
        return productList; 
    }

    
In my test class i created these test records :

 @isTest static void testGetOli () {
        
        List<CreateMultiExtraBoost.oppProduct> productListTest = new List <CreateMultiExtraBoost.oppProduct>(); 
 
        Id pricebookId = Test.getStandardPricebookId();
        
        Product2 pro = new Product2();
        pro.name = 'test';
        pro.Produktbeschreibung_detailliert__c = 'test';
        pro.Family = 'Extra Boost'; 
        pro.IsActive = true;
        insert pro;
        
        Product2 pro1 = new Product2();
        pro1.name = 'test';
        pro1.Produktbeschreibung_detailliert__c = 'test';
        pro1.Family = 'Sonstiges'; 
        pro1.IsActive = true;
        insert pro1;
        
        PricebookEntry pEntry = new PricebookEntry (); 
        pEntry.Product2Id = pro.id;
        pEntry.UseStandardPrice = false;
        pEntry.UnitPrice = 600; 
        pEntry.Pricebook2Id = pricebookId;
        pEntry.IsActive = true;
        insert pEntry;
        
        PricebookEntry pEntry1 = new PricebookEntry (); 
        pEntry1.Product2Id = pro1.id;
        pEntry1.UseStandardPrice = false;
        pEntry1.UnitPrice = 300; 
        pEntry1.Pricebook2Id = pricebookId;
        pEntry1.IsActive = true;
        insert pEntry1;
        
        Opportunity opp = new Opportunity ();
        opp.name = 'test';
        opp.StageName = '40 - Demo Termin vereinbart';
        opp.Override_Region__c = 'München';
        opp.CloseDate = System.today();
        insert opp;
        
           OpportunityLineItem oli = new OpportunityLineItem ();
        oli.TotalPrice = 500;
        oli.Quantity = 4;
        oli.OpportunityId = opp.Id;
        oli.Product2Id = pro.id;
        oli.PricebookEntryId = pEntry.id;
        insert oli;
        
        OpportunityLineItem oli1 = new OpportunityLineItem ();
        oli1.TotalPrice = 500;
        oli1.Quantity = 4;
        oli1.OpportunityId = opp.Id;
        oli1.Product2Id = pro1.id;
        oli1.PricebookEntryId = pEntry1.id;
        insert oli1;
        
        Test.StartTest();
        CreateMultiExtraBoost cme = new CreateMultiExtraBoost();
        cme.getOli();
        Test.StopTest();

i am unable to cover the product_family__c field. It is a formula field, which is related to the product object. Thanks for your help guys ! 
 
Hello guys, 

this apex class includes one wrapper class (cBoost). With the cBoost object and a visualforce page the user is able to select Finalboost records. After the user selection, the class generates XtraBoostOpp__c records. Now, i want to provide a option for the user to create a integer value for each selected FinalBoost record. In the save methode i want to create the XtraBoostOpp__c records and assign the integer value.

In my opinion, i have to create a new variable in my wrapper class (cBoost.menge) . I have tried different ways but nothing worked....
The api name of the XtraBoostOpp__c field is 'Menge__c' .  
public class CreateMultiExtraBoost {

	public List<cBoost> boostList {get; set;}
    public Id opportunityId {get;set;}
        
    // Constructor 
    public CreateMultiExtraBoost (){
    	opportunityId =  ApexPages.currentPage().getparameters().get('oppId');
    }

	//Methode
	public List<cBoost> getBoosts() { 
		if(boostList == null) {
			boostList = new List<cBoost>();
			for(FinalBoost__c fb: [select Id, Name from FinalBoost__c ]) {
				boostList.add(new cBoost(fb));

			}
		}
		return boostList;
	}

	public PageReference save() {
       
		List<FinalBoost__c> selectedBoosts = new List <FinalBoost__c>();
        List<XtraBoostOpp__c> boostItems = new List <XtraBoostOpp__c>(); 
        pagereference oppPage = new pagereference('/' + opportunityId);
    
		for(cBoost cbInList: getBoosts ()) {
			if(cbInList.selected == true ) {
				selectedBoosts.add(cbInList.fbo);
			}
		}

		System.debug('These are the selected ...');
		for(FinalBoost__c con: selectedBoosts) {
			system.debug(con);
		}
        
        for (FinalBoost__c fboInList: selectedBoosts) {
            	
            	XtraBoostOpp__c boost = new XtraBoostOpp__c ();
            	boost.FinalBoost__c = fboInList.Id;
            	boost.Opportunity__c = opportunityId;
            	boost.Menge__c = //user input variable 
				boostItems.add(boost);
    
       }
        insert boostItems;
        return oppPage;
	}
    
   
   // WrapperClass
	public class cBoost {
		public FinalBoost__c fbo {get; set;}
		public Boolean selected {get; set;}
        public Integer menge {get; set;} // user input variable 

		//WrapperClass Constructor 
      public cBoost(FinalBoost__c f) {
			this.fbo = f;
			this.selected = false;
          	this.menge = 0;
      }
	}
}

Thanks for your help guys ! 
 
Hi Guys,

this is my code :
public class CreateMultiExtraBoost {

	public List<cBoost> boostList {get; set;}
    Integer listSize {get;set;}
    public Id opportunityId {get;set;}
    public ID finalBoostId {get; set;}
        
    // Constructor 
    public CreateMultiExtraBoost (){
    	opportunityId =  ApexPages.currentPage().getparameters().get('oppId');
    }

	//Methode
	public List<cBoost> getBoosts() {
		if(boostList == null) {
			boostList = new List<cBoost>();
			for(FinalBoost__c c: [select Id, Name from FinalBoost__c ]) {
				boostList.add(new cBoost(c));
			}
		}
		return boostList;
	}

	public PageReference save() {
 
		List<FinalBoost__c> selectedContacts = new List <FinalBoost__c>();
        List<BoostOpp__c> boostItems = new List <BoostOpp__c>(); 
        pagereference oppPage = new pagereference('/' + opportunityId);

		for(cBoost cCon: getBoosts ()) {
			if(cCon.selected == true ) {
				selectedContacts.add(cCon.con);
			}
		}

		System.debug('These are the selected ...');
		for(FinalBoost__c con: selectedContacts) {
			system.debug(con);
		}
        
        for (FinalBoost__c con: selectedContacts) {
            	boostItems.add(new BoostOpp__c());
            	finalBoostId = con.Id;
            
            		for(BoostOpp__c boostIteminList : boostItems) {
                        boostIteminList.Opportunity__c = opportunityId;
                        boostIteminList.FinalBoost__c = finalBoostId;
       	 }
       }
        insert boostItems;
        return oppPage;
	}
    
   
   // WrapperClass
	public class cBoost {
		public FinalBoost__c con {get; set;}
		public Boolean selected {get; set;}

		// Constructor 
        public cBoost(FinalBoost__c c) {
			con = c;
			selected = false;
		}
	}
}

A visualforcepage shows the table of FinalBoost records. I can select records and use them in the save methode.  The BoostOpp__c object is a junction object. It is related to the opportunity and the FinalBoost Object. 

In my loop, i want to create for each selected record one child record and assign the parent id (FinalBoost) to the masterDetail field. At the moment, it creates for each selection one record but allways with the same finalBoostId.  Is there a simple solution for that ? 


Cheers Sandra
Hello Guys,

i have created a simple custom controller to create multipe junction records.  The master object ist the opportunity object. Here is my Code

public class AddingBoostsController {

    public List<BoostOpp__c > BoostList {get;set;}
    public Integer rowNum{get;set;}

    public AddingBoostsController(){
        BoostList = new List<BoostOpp__c>();  
        BoostList.add(new BoostOpp__c()); 
            
    }
    
    public void insertBoost(){
        insert BoostList; 
    }
 
    public void insertRow(){
        BoostList.add(new BoostOpp__c()); 
    }
    
    
    public void delRow(){
        rowNum = Integer.valueOf(apexpages.currentpage().getparameters().get('index'));
        BoostList.remove(rowNum);   
    }
}

A Javascript Button is calling the visualforce Page.  Now, i am looking for a solution to get the record id of the opportunity record to 

1. assign it each record in the list 
2. return to the master record, after the list is inserted 

Is there a way to use a javascript variable in the apex code ? 


Greetings Sandra
 
I have 2 fields, one is custom text field A and second is PAP lookup field. Both fields are under Contacts. Is there a way to copy text from text field 'A' to lookup field 'PAP'? PAP lookup field is looking up to Account Name.