• Masie Maseli
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 6
    Replies
I have a field on the product that I would like visible as quote line items are entered. Can someone please tell me what is wrong with my code below?
trigger UpdateFormulaFields on QuoteLineItem (before insert,before update) {

 set<id> PIds = new set<id>();
   for(QuoteLineItem qli : Trigger.new){
       PIds.add(qli.Product2Id);
   }
     list<Product2> pList = [select id, name , Cost_Price__c, Quantity_On_Hand__c, In_Stock_Pricing__c  from Product2 where Id IN : PIds];  
     for(Product2 p : pList){
      
         for(QuoteLineItem ql : Trigger.new){
             if(p.id == ql.product2Id){
                
                 if(Trigger.isInsert){
                     
                 	ql.Cost_Price__c = p.Cost_Price__c;
                    ql.Quantity_On_Hand__c = p.Quantity_On_Hand__c;
                    ql.In_Stock_Price2__c = p.In_Stock_Pricing__c;
             	
                 }
                 if(Trigger.isUpdate){
                                     
                    ql.Cost_Price__c = p.Cost_Price__c;
                    ql.Quantity_On_Hand__c = p.Quantity_On_Hand__c;
                    ql.In_Stock_Price2__c = p.In_Stock_Pricing__c;
                     
                 }
             }
             
       }
    }
    update pList;
  
}
Hi

I have a very simple trigger to update a few fields based on a formula field but its not updating. The trigger assist in showing the values of the formula field on the edit screen of my quote line items. Can someone please help.
trigger UpdateFieldsFormula on QuoteLineItem (before insert, before update) {
        
        for(QuoteLineItem q:trigger.new)
        {
         q.Quantity_on_hand__c = q.Product_Quantity_On_Hand__c;
         q.Cost_Price__c = q.Product_Cost_Price__c;
         q.In_Stock_Price2__c = q.In_Stock_Pricing__c;
 
}
}

 
May someone please help, I have a visualforce wizard that updates a lead, creates two custom object records and is supposed to keep updating the same record from one page to another. I can create the two records but when it is supposed to update the record it cannot find the record id that was created in the previous page, public PageReference purposeSaveBtn().  So my code is not working from  ​public PageReference strategySaveBtn()  can someone please assist.
public class benchmarkingExtension{

    Private Final Lead thelead;
    public Benchmarking_Result__c br {get;set;}
    public Benchmarking_Focus_Area__c fc {get;set;}
     
    public List <string> checkboxSelections {get;set;}

   Public ApexPages.StandardController stdcontroller;
    
    // The extension constructor initializes the private member variable acct by using the getRecord method from the standard controller.
    public benchmarkingExtension(ApexPages.StandardController stdcontroller) {
        this.thelead = (Lead)stdController.getRecord();
        getBenchmarking_Focus_Area();
        getBr();
    }
    
    public Benchmarking_Focus_Area__c getBenchmarking_Focus_Area(){
         if( fc == null) { fc = new Benchmarking_Focus_Area__c(); }  
         else{
         fc = [select id, name from Benchmarking_Focus_Area__c where Lead__c = :thelead.id]; 
         }
       return fc;
   }
   
    public  Benchmarking_Result__c getBr() {
    if (br == null ){
    br = new Benchmarking_Result__c();
    
    }
    else{
      br = [select id, CSI_part_of_company_culture__c, Responsibility_Measurement__c , Allocation_of_Impact__c , Government_Interaction__c , Engagement_with_Government__c, Reasons_for_not_Partnering__c ,  Branding__c , Amount_of_Partnerships__c , Signed_MOUs__c , Company_Vision_Social_Impact__c , Who_partner_with__c , Alignment_to_Vision_and_Mission__c , Financial_contribution__c , Clear_Vision_Mission__c, Living_of_CSI_Vision__c,  CSI_team_knows_reason_for_existance__c, Reason_for_CSI__c from Benchmarking_Result__c where Lead__c = :thelead.id];
    }
        return br;
    }

   public Lead getLead(){
   
     return thelead;
   }
    
    
    
    //Method for populating checkboxes -- q1
    
    public List<SelectOption> getItems(){
        
        Schema.sObjectType sobject_type = Benchmarking_Result__c.getSObjectType();
        Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();
        Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();
        List<Schema.PicklistEntry> pick_list_values = field_map.get('Clear_CSI_Strategy_Result__c').getDescribe().getPickListValues();
        
        List<selectOption> items = new List<selectOption>();
        for (Schema.PicklistEntry a : pick_list_values){
            items.add(new SelectOption(a.getLabel(), a.getValue())); 
        }
        
        return items;
    }  
    public List<SelectOption> getItems1(){
        
        Schema.sObjectType sobject_type = Benchmarking_Result__c.getSObjectType();
        Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();
        Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();
        List<Schema.PicklistEntry> pick_list_values = field_map.get('Who_partner_with__c').getDescribe().getPickListValues();
        
        List<selectOption> items1 = new List<selectOption>();
        for (Schema.PicklistEntry a : pick_list_values){
            items1.add(new SelectOption(a.getLabel(), a.getValue())); 
        }
        
        return items1;
    }
    
    // M&E question 7 
  //      public List<SelectOption> getItems3(){
        
   //     Schema.sObjectType sobject_type = Benchmarking_Result__c.getSObjectType();
   //     Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();
    //    Map<String, Schema.SObjectField> field_map3 = sobject_describe.fields.getMap();
     //   List<Schema.PicklistEntry> pick_list_values = field_map3.get('Challenges_with_M_E__c').getDescribe().getPickListValues();
     //   
     //   List<selectOption> items3 = new List<selectOption>();
    //    for (Schema.PicklistEntry a : pick_list_values){
    //       items3.add(new SelectOption(a.getLabel(), a.getValue())); 
     //  }
        
    //    return items3;
  //  }
    




///
    //Methods for 'Save' buttons on VF pages
     public PageReference cancel() {
        return null;
    }
    
    public PageReference filteringCriteriaSaveBtn() {
       
        update thelead; 
        
        fc.Lead__c = thelead.Id;
        fc.name = 'Focus Area' ;
        upsert fc;
        
        PageReference callNextPage = new PageReference('/apex/Purpose?id='+thelead.id);
        callNextPage.setRedirect(true);
        return callNextPage;
    }
    
    
    public PageReference purposeSaveBtn() {
        br.Lead__c = theLead.id;
        br.name = 'Benchmark Result' ;
        upsert br; 
        
        PageReference callNextPage = new PageReference('/apex/Strategy_Developement?id='+thelead.id); 
        callNextPage.setRedirect(true);
        return callNextPage;
    }
    
    
    public PageReference strategicDevSaveBtn() {
        
        update br;
        
        PageReference callNextPage = new PageReference('/apex/Implementation?id='+thelead.id);      
        callNextPage.setRedirect(true);
        return callNextPage;
    }
    
    
    
   public PageReference strategySaveBtn() {
        
        update br;
        
        PageReference callNextPage= new PageReference('/apex/Collaboration?id='+thelead.id);    
        callNextPage.setRedirect(true);
        return callNextPage;
    }
    
    
    public PageReference implementationDevSaveBtn() {
       // update br;
        stdcontroller.save();
        PageReference callNextPage= new PageReference('/apex/CSI_Positioning_And_Governence?id='+thelead.id);
        callNextPage.setRedirect(true);
        return callNextPage;
    }
    public PageReference CollaborationDevSaveBtn() {
        update br; 
        PageReference callNextPage= new PageReference('/apex/M_And_E?id='+thelead.id);
        callNextPage.setRedirect(true);
        return callNextPage;
    }
    
    public PageReference MAndEDevSaveBtn(){
       // update br;
        stdcontroller.save();
        PageReference callNextPage= new PageReference('/apex/CSI_Positioning_And_Governence?id='+thelead.id);
        callNextPage.setRedirect(true);
        return callNextPage;
    }
    
    
    public PageReference CSI_PositioningDevSaveBtn() {
       // update br;
        stdcontroller.save();
        PageReference callNextPage= Page.Team;
        callNextPage.setRedirect(true);
        return callNextPage;
    }
    
    public PageReference TeamSaveBtn() {
       // update br;
        stdcontroller.save();
        PageReference callNextPage=new PageReference('/apex/Innovation?id='+thelead.id);
        callNextPage.setRedirect(true);
        return callNextPage;
    }
    
    public PageReference InnovationSaveBtn() {
        update br;
        PageReference callNextPage= new PageReference('/apex/OutputPage?id='+thelead.id);
        callNextPage.setRedirect(true);
        return callNextPage;
    }
    
}

 
Hi all, I need some assistance.
We have a wizard type visualforce page developmnet that uses 3 objects- Lead, Custom obj 1 and Custom obj 2. The custom objects all have lookup relationships with the lead object.
What is supposed to happen is that we will send you a link to a site that includes the Lead Id, Page 1 that opens up has lead fields that need updating and Custom obj 1 records that need to be created when you select the Continue button. And we need to pass the Lead Id to Page 2.
On Page two when selecting Continue a record for Custom Obj 2 needs to be created and the Lead Id that was passed from Page 1 needs to be assigned to the Lead field on Custom Obj 2. We also need the Custom Obj 2 ID to be passed on to the next page, Page 3.

Can anyone help with the controller?
Hi,

I have a visualforce page where a person can create new contacts. I would like this to be more dynamic so based on a field with a value I would like the page to render the exact amount of fields needed to be filled in. So if the number field says 1 then the page must provide space to only create one contact and if the number field says 10 then the fields to create 10 contacts should be shown.

Is this possible?
Hi all

I have custom list view button that changes a record's ownership to the current user. I want to find out if it is possible to have the button open the standard change owner screen? 
Hi

I have a very simple trigger to update a few fields based on a formula field but its not updating. The trigger assist in showing the values of the formula field on the edit screen of my quote line items. Can someone please help.
trigger UpdateFieldsFormula on QuoteLineItem (before insert, before update) {
        
        for(QuoteLineItem q:trigger.new)
        {
         q.Quantity_on_hand__c = q.Product_Quantity_On_Hand__c;
         q.Cost_Price__c = q.Product_Cost_Price__c;
         q.In_Stock_Price2__c = q.In_Stock_Pricing__c;
 
}
}

 
May someone please help, I have a visualforce wizard that updates a lead, creates two custom object records and is supposed to keep updating the same record from one page to another. I can create the two records but when it is supposed to update the record it cannot find the record id that was created in the previous page, public PageReference purposeSaveBtn().  So my code is not working from  ​public PageReference strategySaveBtn()  can someone please assist.
public class benchmarkingExtension{

    Private Final Lead thelead;
    public Benchmarking_Result__c br {get;set;}
    public Benchmarking_Focus_Area__c fc {get;set;}
     
    public List <string> checkboxSelections {get;set;}

   Public ApexPages.StandardController stdcontroller;
    
    // The extension constructor initializes the private member variable acct by using the getRecord method from the standard controller.
    public benchmarkingExtension(ApexPages.StandardController stdcontroller) {
        this.thelead = (Lead)stdController.getRecord();
        getBenchmarking_Focus_Area();
        getBr();
    }
    
    public Benchmarking_Focus_Area__c getBenchmarking_Focus_Area(){
         if( fc == null) { fc = new Benchmarking_Focus_Area__c(); }  
         else{
         fc = [select id, name from Benchmarking_Focus_Area__c where Lead__c = :thelead.id]; 
         }
       return fc;
   }
   
    public  Benchmarking_Result__c getBr() {
    if (br == null ){
    br = new Benchmarking_Result__c();
    
    }
    else{
      br = [select id, CSI_part_of_company_culture__c, Responsibility_Measurement__c , Allocation_of_Impact__c , Government_Interaction__c , Engagement_with_Government__c, Reasons_for_not_Partnering__c ,  Branding__c , Amount_of_Partnerships__c , Signed_MOUs__c , Company_Vision_Social_Impact__c , Who_partner_with__c , Alignment_to_Vision_and_Mission__c , Financial_contribution__c , Clear_Vision_Mission__c, Living_of_CSI_Vision__c,  CSI_team_knows_reason_for_existance__c, Reason_for_CSI__c from Benchmarking_Result__c where Lead__c = :thelead.id];
    }
        return br;
    }

   public Lead getLead(){
   
     return thelead;
   }
    
    
    
    //Method for populating checkboxes -- q1
    
    public List<SelectOption> getItems(){
        
        Schema.sObjectType sobject_type = Benchmarking_Result__c.getSObjectType();
        Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();
        Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();
        List<Schema.PicklistEntry> pick_list_values = field_map.get('Clear_CSI_Strategy_Result__c').getDescribe().getPickListValues();
        
        List<selectOption> items = new List<selectOption>();
        for (Schema.PicklistEntry a : pick_list_values){
            items.add(new SelectOption(a.getLabel(), a.getValue())); 
        }
        
        return items;
    }  
    public List<SelectOption> getItems1(){
        
        Schema.sObjectType sobject_type = Benchmarking_Result__c.getSObjectType();
        Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();
        Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();
        List<Schema.PicklistEntry> pick_list_values = field_map.get('Who_partner_with__c').getDescribe().getPickListValues();
        
        List<selectOption> items1 = new List<selectOption>();
        for (Schema.PicklistEntry a : pick_list_values){
            items1.add(new SelectOption(a.getLabel(), a.getValue())); 
        }
        
        return items1;
    }
    
    // M&E question 7 
  //      public List<SelectOption> getItems3(){
        
   //     Schema.sObjectType sobject_type = Benchmarking_Result__c.getSObjectType();
   //     Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();
    //    Map<String, Schema.SObjectField> field_map3 = sobject_describe.fields.getMap();
     //   List<Schema.PicklistEntry> pick_list_values = field_map3.get('Challenges_with_M_E__c').getDescribe().getPickListValues();
     //   
     //   List<selectOption> items3 = new List<selectOption>();
    //    for (Schema.PicklistEntry a : pick_list_values){
    //       items3.add(new SelectOption(a.getLabel(), a.getValue())); 
     //  }
        
    //    return items3;
  //  }
    




///
    //Methods for 'Save' buttons on VF pages
     public PageReference cancel() {
        return null;
    }
    
    public PageReference filteringCriteriaSaveBtn() {
       
        update thelead; 
        
        fc.Lead__c = thelead.Id;
        fc.name = 'Focus Area' ;
        upsert fc;
        
        PageReference callNextPage = new PageReference('/apex/Purpose?id='+thelead.id);
        callNextPage.setRedirect(true);
        return callNextPage;
    }
    
    
    public PageReference purposeSaveBtn() {
        br.Lead__c = theLead.id;
        br.name = 'Benchmark Result' ;
        upsert br; 
        
        PageReference callNextPage = new PageReference('/apex/Strategy_Developement?id='+thelead.id); 
        callNextPage.setRedirect(true);
        return callNextPage;
    }
    
    
    public PageReference strategicDevSaveBtn() {
        
        update br;
        
        PageReference callNextPage = new PageReference('/apex/Implementation?id='+thelead.id);      
        callNextPage.setRedirect(true);
        return callNextPage;
    }
    
    
    
   public PageReference strategySaveBtn() {
        
        update br;
        
        PageReference callNextPage= new PageReference('/apex/Collaboration?id='+thelead.id);    
        callNextPage.setRedirect(true);
        return callNextPage;
    }
    
    
    public PageReference implementationDevSaveBtn() {
       // update br;
        stdcontroller.save();
        PageReference callNextPage= new PageReference('/apex/CSI_Positioning_And_Governence?id='+thelead.id);
        callNextPage.setRedirect(true);
        return callNextPage;
    }
    public PageReference CollaborationDevSaveBtn() {
        update br; 
        PageReference callNextPage= new PageReference('/apex/M_And_E?id='+thelead.id);
        callNextPage.setRedirect(true);
        return callNextPage;
    }
    
    public PageReference MAndEDevSaveBtn(){
       // update br;
        stdcontroller.save();
        PageReference callNextPage= new PageReference('/apex/CSI_Positioning_And_Governence?id='+thelead.id);
        callNextPage.setRedirect(true);
        return callNextPage;
    }
    
    
    public PageReference CSI_PositioningDevSaveBtn() {
       // update br;
        stdcontroller.save();
        PageReference callNextPage= Page.Team;
        callNextPage.setRedirect(true);
        return callNextPage;
    }
    
    public PageReference TeamSaveBtn() {
       // update br;
        stdcontroller.save();
        PageReference callNextPage=new PageReference('/apex/Innovation?id='+thelead.id);
        callNextPage.setRedirect(true);
        return callNextPage;
    }
    
    public PageReference InnovationSaveBtn() {
        update br;
        PageReference callNextPage= new PageReference('/apex/OutputPage?id='+thelead.id);
        callNextPage.setRedirect(true);
        return callNextPage;
    }
    
}

 
Hi,

I have a visualforce page where a person can create new contacts. I would like this to be more dynamic so based on a field with a value I would like the page to render the exact amount of fields needed to be filled in. So if the number field says 1 then the page must provide space to only create one contact and if the number field says 10 then the fields to create 10 contacts should be shown.

Is this possible?
Hi all

I have custom list view button that changes a record's ownership to the current user. I want to find out if it is possible to have the button open the standard change owner screen?