• 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 
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.