• Ram Arza
  • NEWBIE
  • 30 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 7
    Replies
Hello,

I am trying to insert a profile called "Vendor Partner Portal" for a user in my test class. When I run the tests I am getting an error message saying  System.DmlException: Insert failed. First exception on row 0; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): User, original object: Product_Line__c: []

Stack Trace: Class.Test_salesQuotes.runasPartner: line 230, column 1
Below is my code. Can someone help me find what the issue is
 
@isTest()
public class Test_salesQuotes{
public static testmethod void method1(){

//Method 1
      // To begin, the sample application first creates the necessary records
      // to test OpportunityLineItems: Pricebook2, Product2, and PricebookEntry
      // First it creates a product with a standard price
      Product2 p = new product2(name='gack',isActive=true);
      insert p;
      Id pricebookId = Test.getStandardPricebookId();
      
      try{
        insert new PricebookEntry(pricebook2id = pricebookId, product2id = p.id, 
                                unitprice=1.0, isActive=true);
      }catch(System.DMLException e){
        //Swallow exception.. Trigger should have already created the Standard PB entry for this product.
      }
      
      // Next, it creates a new pricebook with an entry for this product
      Pricebook2 pb = new pricebook2(name='test', Ext_Ref_Id__c='asldfjlakjsdf234234');
      insert pb;
      PricebookEntry pbe = new PricebookEntry(pricebook2id=pb.id, product2id=p.id, 
                                              unitprice=1.0, isActive=true);
      insert pbe;
      // To test the first example from the sample application, the test
      // method creates an opportunity line item using the pricebook entry,
      // and then asserts that the Color field was correctly copied from the
      // product after record insertion.
      Opportunity o = new Opportunity(name='test', pricebook2id=pb.id,
      stageName='Open', CloseDate=Date.newInstance(2006,10,10));
      insert o;
      OpportunityLineItem oli = new OpportunityLineItem(opportunityid=o.id, 
                                pricebookentryid=pbe.id, unitprice=1.5, quantity=2);
      insert oli;
    
      // To test the fifth example from the sample application, the test method
      // creates a primary quote and then asserts that its Primary field cannot
      // be deselected. The code uses the try...catch testing idiom to assert
      // that the error message is correct.
      SFDC_520_Quote__c q = new SFDC_520_Quote__c(opportunity__c = o.id, primary__c = true);
      insert q;    
}

//Method2
  
  static testmethod void t1() {
    SFDC_520_Quote__c q = new SFDC_520_Quote__c(); 
    insert q; 
    salesQuotes s = new salesQuotes( new ApexPages.StandardController(q ) );
          
  }

//Method3
   public static  testMethod  void test1() {
      Product_Line__c pl = new Product_Line__c(name = 'myPL');
      insert pl;     

     Product2 p = new product2(name='gack',family='gack',productcode='gack',Product_Line__c=pl.Id,isActive=true);
      insert p;
       
       Product2 p3 = new product2(name='gack',family='gack',productcode='gack',Product_Line__c=pl.Id,isActive=true);
       p3.Loanable__c=true;
      insert p3;
      
      Id pricebookId = Test.getStandardPricebookId();
      
      try{
          insert new PricebookEntry(pricebook2id = pricebookId, product2id = p.id, 
                                unitprice=1.0, isActive=true);
      }catch(System.DMLException e){
        //Swallow exception - creating the product2 should have created a standard 
        //PricebookEntry already.
      }    
        // Next, it creates a new pricebook with an entry for this product
        Pricebook2 pb = new pricebook2(name='test', Ext_Ref_Id__c='asldfjlakjsdf234234');
        insert pb;
        PricebookEntry pbe = new PricebookEntry(pricebook2id=pb.id, product2id=p.id, 
                                              unitprice=1.0, isActive=true);
        insert pbe;
               
        Opportunity o = new Opportunity(name='test', pricebook2id=pb.id,
        stageName='Open', CloseDate=Date.newInstance(2006,10,10));
        insert o;
        OpportunityLineItem oli = new OpportunityLineItem(opportunityid=o.id, 
                                pricebookentryid=pbe.id, unitprice=1.5, quantity=2);
        insert oli;
        
    SFDC_520_Quote__c q = new SFDC_520_Quote__c(Opportunity__c = o.id); 
    insert q;
     
     id VendorPQRecordType = [select Id FROM RecordType where Name = 'Primary Cells Request'].Id;
       
      SFDC_520_Quote__c q1 = new SFDC_520_Quote__c(Opportunity__c = o.id); 
      q1.recordtypeid=VendorPQRecordType;
     insert q1; 
    
    PageReference pageRef = Page.AddQuoteLines;
        Test.setCurrentPage(pageRef);
      system.debug( 'quote id is '+q.id);
      
      ApexPages.currentPage().getParameters().put('id', q.id);
      
     salesQuotes s = new salesQuotes();
     ApexPages.currentPage().getParameters().put('reloadQuote','1');
       
     ApexPages.currentPage().getParameters().put('id', q1.id);
      
     salesQuotes s1 = new salesQuotes();
     ApexPages.currentPage().getParameters().put('reloadQuote','1');
       
     ApexPages.currentPage().getParameters().put('userTypeName', null);
       
     system.assertEquals('Standard',s1.UserTypeName);
     
     s1.CopyOperation(); 
     s.CopyOperation();
     
     s.save(  ) ;
     system.debug ( s.total );
     
     ApexPages.currentPage().getParameters().put('pid', p.id);
     s.enableAddProducts();
     s.searchStr='g';
     s.doSearch(); 
     Id [] fixedSearchResults= new Id[1];
         fixedSearchResults[0] = p.id;
         Test.setFixedSearchResults(fixedSearchResults);
     
     s.searchStr = 'gac';
     s.sortField = 'Product_Line__c';
     s.doSearch();
     
     try { s.addProd();
       // search does not find products inserted by test?
     } catch( System.NullPointerException npe) {
     }
     
     s.copyAndEdit();
 //  s.queryQuoteLines( s.quote.id); 
     s.recalc();
     
     s1.copyLineItemsFromQuoteToOppty();
       
     Account acct = test_standardobjectutil.createAccount('Test Account', false);
    // acct.IsPartner=true;
     insert acct;
       
     Contact c = test_standardobjectutil.createContact('John','Doe2', false);
     c.accountid = acct.Id;
     insert c;                  
   }

    /* Method 4*/
    
    public static  testMethod  void runasPartner() {
         
         Product_Line__c pl = new Product_Line__c(name = 'myPL');
      insert pl;     

     Product2 p = new product2(name='gack',family='gack',productcode='gack',Product_Line__c=pl.Id,isActive=true);
      insert p;
       
       Product2 p3 = new product2(name='gack',family='gack',productcode='gack',Product_Line__c=pl.Id,isActive=true);
       p3.Loanable__c=true;
      insert p3;
  Id pricebookId = Test.getStandardPricebookId();     
      try{
          insert new PricebookEntry(pricebook2id = pricebookId , product2id = p.id, 
                                unitprice=1.0, isActive=true);
      }catch(System.DMLException e){
        //Swallow exception - creating the product2 should have created a standard 
        //PricebookEntry already.
      }
      
        Pricebook2 pb = new pricebook2(name='test', Ext_Ref_Id__c='asldfjlakjsdf234234');
        insert pb;
        PricebookEntry pbe = new PricebookEntry(pricebook2id=pb.id, product2id=p.id, 
                                              unitprice=1.0, isActive=true);
        insert pbe;
     
       Opportunity o = new Opportunity(name='test', pricebook2id=pb.id,
        stageName='Open', CloseDate=Date.newInstance(2006,10,10));
        insert o;
        OpportunityLineItem oli = new OpportunityLineItem(opportunityid=o.id, 
                                pricebookentryid=pbe.id, unitprice=1.5, quantity=2);
        insert oli;
        
     SFDC_520_Quote__c q = new SFDC_520_Quote__c(Opportunity__c = o.id); 
    insert q;
   
      id VendorPQRecordType = [select Id FROM RecordType where Name = 'Primary Cells Request'].Id;
        
       SFDC_520_Quote__c q1 = new SFDC_520_Quote__c(Opportunity__c = o.id); 
         q1.recordtypeid=VendorPQRecordType;
     insert q1;
     
    PageReference pageRef = Page.AddQuoteLines;
        Test.setCurrentPage(pageRef);
      system.debug( 'quote id is '+q.id);
      
      ApexPages.currentPage().getParameters().put('id', q.id);
      
     salesQuotes s = new salesQuotes();
     ApexPages.currentPage().getParameters().put('reloadQuote','1');
       
     ApexPages.currentPage().getParameters().put('id', q1.id);
      
     salesQuotes s1 = new salesQuotes();
     ApexPages.currentPage().getParameters().put('reloadQuote','1');
       
     ApexPages.currentPage().getParameters().put('userTypeName', null);
       
     system.assertEquals('Standard',s1.UserTypeName);
     
        Account acct = test_standardobjectutil.createAccount('Test Account', false);
    // acct.IsPartner=true;
     insert acct;
       
     Contact c = test_standardobjectutil.createContact('John','Doe2', false);
     c.accountid = acct.Id;
     insert c;  
     
     Profile userProfile = [SELECT Id FROM Profile WHERE Name='Vendor Partner Portal']; 
     User u = new User(Alias = 't23', Email='teststandarduser@stemcell.com', 
     EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', 
     LocaleSidKey='en_US', ProfileId = userProfile.Id,
     ContactId = c.id,
     TimeZoneSidKey='America/Los_Angeles', UserName='teststandarduser@stemcell.com');
     insert u;
        system.runAs(u){
            
            ApexPages.currentPage().getParameters().put('pid', p.id);
             s.enableAddProducts();
             s.searchStr='g';
            system.debug('Test exact user:'+ u); 
            s.doSearch(); 
        }
   }
   }

 
I have trouble comparing old and new Account OwnerID. I see an error message saying  "Error: Compile Error: Invalid field OwnerId for SObject User at line 13 column 46". Below is my code. Please assist.
 
trigger ContactOwnerID on Account (After Insert, After Update) {

List<Account>AccList = new List<Account>();
Map<id,user>OldUserMap = new Map<id,user>();
Map<id,user>NewUserMap = new Map<id,user>();
List<Contact>ConList = new List<Contact>();
List<Contact>UpdatedConList = new List<Contact>();
List<Contact>FinalConList = new List<Contact>();



For(Account A:Trigger.new){
If(A.OwnerId != Null && OldUserMap.get(A.id).OwnerId != NewUserMap.get(A.id).OwnerId){
AccList.add(A);
}
If(!AccList.isEmpty()){
ConList =[Select id, OwnerId, AccountId from Contact where AccountId =: AccList];
}
}
If(!ConList.isEmpty()){
For(Contact c:UpdatedConList){
c.OwnerId = c.account.ownerid;
FinalConList.add(c);
}
}
If(!FinalConList.isEmpty()){
Update FinalConList;
}
}

 
I have 2 triggers calling 2 different handler classes on the same object . As part of best practise I want to call both the classes from a single trigger. I am not sure how to call them. Below are my two triggers.
 
trigger ShippingAddress on Shipping_Address__c (after delete, 
                             after insert,  
                             after undelete, 
                             after update, 
                             before delete, 
                             before insert, 
                             before update ) {
    try  
    {
        ITriggerHandler handler = new SingleTriggerHandler (
                                        new ShippingAddressTriggerHandler(),
                                        Trigger.isExecuting,
                                        Trigger.isInsert, 
                                        Trigger.isUpdate, 
                                        Trigger.isDelete, 
                                        Trigger.isBefore, 
                                        Trigger.isAfter, 
                                        Trigger.isUndelete, 
                                        Trigger.new, 
                                        Trigger.newMap, 
                                        Trigger.old, 
                                        Trigger.oldMap, 
                                        Trigger.size );
        handler.process(); 
    }
    catch (AbstractTriggerHandler.InvalidTriggerInvocationException itie)
    {
        SystemExceptionLogger.insertSystemExceptionLogEntry(
                                        itie, 
                                        'Shipping Address Application - Common Use', 
                                        'Shipping Address Trigger', 
                                        SystemExceptionLogger.EXCEPTION_LEVEL_INFO);
        
    }
    catch (Exception e)
    {
        SystemExceptionLogger.insertSystemExceptionLogEntry(
                                        e, 
                                        'Shipping Address Trigger Application - Common Use', 
                                        'Shipping Address Trigger', 
                                        SystemExceptionLogger.EXCEPTION_LEVEL_CRITICAL);
        throw e;
    }

}
Trigger 2
trigger StagingShippingAddress on Shipping_Address__c (after delete, 
                             after insert,  
                             after undelete, 
                             after update, 
                             before delete, 
                             before insert, 
                             before update ) {
    try  
    {
        ITriggerHandler handler = new SingleTriggerHandler (
                                        new StagingShippingTriggerHandler(),
                                        Trigger.isExecuting,
                                        Trigger.isInsert, 
                                        Trigger.isUpdate, 
                                        Trigger.isDelete, 
                                        Trigger.isBefore, 
                                        Trigger.isAfter, 
                                        Trigger.isUndelete, 
                                        Trigger.new, 
                                        Trigger.newMap, 
                                        Trigger.old, 
                                        Trigger.oldMap, 
                                        Trigger.size );
        handler.process(); 
    }
    catch (AbstractTriggerHandler.InvalidTriggerInvocationException itie)
    {        SystemExceptionLogger.insertSystemExceptionLogEntry(itie,'Shipping Address Application - Common Use','Shipping Address Trigger',SystemExceptionLogger.EXCEPTION_LEVEL_INFO);
        
    }
    catch (Exception e)
    {        SystemExceptionLogger.insertSystemExceptionLogEntry(e,'Shipping Address Trigger Application - Common Use','Shipping Address Trigger',SystemExceptionLogger.EXCEPTION_LEVEL_CRITICAL); throw e;
    }

}


 
I have created a url hack Custom link for one of my report and it works as expected taking me to the report page based on the account id but when i try the same custom link on my salesforce1 it is picking some random reports which are no way related to account. ANy idea what could be the reason. 
Shipping VFPage:
<apex:page controller="Diffrectypes"> <apex:pageBlock title="VFPage1"> <apex:pageBlockSection title="VFPageSection1"> </apex:pageBlockSection> </apex:pageBlock>


MarketingVFPage
<apex:page controller="Diffrectypes"> <apex:pageBlock title="VFPage1"> <apex:pageBlockSection title="VFPageSection1"> </apex:pageBlockSection> </apex:pageBlock>


SalesVFPage
<apex:page controller="Diffrectypes"> <apex:pageBlock title="VFPage1"> <apex:pageBlockSection title="VFPageSection1"> </apex:pageBlockSection> </apex:pageBlock>


I want to create a controller with a method to call vfpage based on recordtype. when recordtype is selected and continue button is clicked . but I am not sure how to do it. how can I achieve it.
Can someone tell me why is this error message occuring and how can i solve it.
 
<apex:column style="vertical-align: text-top;" headerValue="Unit Price" rendered="{! AND(OR( $ObjectType.SFDC_520_QuoteLine__c.Fields.Unit_Price__c.createable, $ObjectType.SFDC_520_QuoteLine__c.Fields.Unit_Price__c.updateable), SFDC_520_Quote__c.recordtype.name!='Custom Quotation' ) }">
                        <apex:inputField required="true" value="{!item.quoteline.Unit_Price__c}" onchange="sayHello();" />
                    </apex:column>

 
I have a scenario on a custom object called VM_Sales_Order__c with 6 record types named FAS, FSAL, ISAL, National Manager, Regional Manager and VP. Whenever I select a record type it should take me to its respective vf page. For example, when FAS record type is selected and new button is clicked it should take me to FAS VF Page. 

Below is the VF page and controller I wrote. Can someone check this code and let me know what would be the next step or if any changes required in this code.

My VF Page:
<apex:page standardController="Revenue_Reports__c" extensions="FAS_intercontroller" action="!FASpageRedirect">

</apex:page>
My Controller Code:
 
public with sharing class FAS_intercontroller {

public Revenue_Reports__c R1;

    public FAS_intercontroller (ApexPages.StandardController controller) {
    this.R1 = (Revenue_Reports__c)controller.getRecord();

    }
    
        public PageReference FASpageRedirect() {
        if(ApexPages.currentPage().getParameters().get('RecordType') == '012230000004KYF'){
            PageReference pageRef = new PageReference('/apex/RevenueReports_FAS_VfPge');
            return pageRef;
            }
             else if(ApexPages.currentPage().getParameters().get('RecordType') == '012230000004KYj'){
             PageReference pageRef1 = new PageReference('/apex/RevenueReports_FSAL_VFPage');
             return pageRef1;
             }
             else if(ApexPages.currentPage().getParameters().get('RecordType') == '012230000004KYP'){
             PageReference pageRef2 = new PageReference('/apex/RevenueReports_ISAL_VfPge');
             return pageRef2;
             }
             else if(ApexPages.currentPage().getParameters().get('RecordType') == '012230000004KYU'){
             PageReference pageRef3 = new PageReference('/apex/RevenueReports_NationalManager_VFPage');
             return pageRef3;
             }
             else if(ApexPages.currentPage().getParameters().get('RecordType') == '012230000004KYZ'){
             PageReference pageRef4 = new PageReference('/apex/RevenueReports_RegionalManager_VFPage');
             return pageRef4;
             }
             else if(ApexPages.currentPage().getParameters().get('RecordType') == '012230000004KYe'){
             PageReference pageRef5 = new PageReference('/apex/RevenueReports_VP_VFPage');
             return pageRef5;
             }
             
             return null;
             }
             }
Any help is appreciated.



 
I am encountering below error when trying to deploy the a class. Below is error and class. I am not sure why i get this error.

error is 
No such column 'Single_Donor__c' on entity 'OpportunityLineItem'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

 
if(quoteRecordtype=='Primary Cells Request'){ 
        olist = [Select Id, OpportunityId, SortOrder, PricebookEntryId, Quantity,ETA__c, 
        TotalPrice, UnitPrice, ListPrice, ServiceDate, Description, CreatedDate, 
        CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp, Sales_Discount__c,opportunity.recordtype.name,
        Age__c,Anticoagulant__c,Cell_Isolation__c,Cells_per_Vial__c,Multiple_Donors__c,Single_Donor__c,Product_State__c,Desired_Cell_type__c,
        Donor_Blood_Type__c,End_Age__c,Ethnicity__c,Gender__c,Healthy_Tissue_Type__c,Product_Specifications__c,
        Medication_Constraints__c,Other_Info__c,Medication_Constraints_Other__c,Specific_Donor_s__c,HLA_Type__c,ADCC_Status__c,
       Other_Requirements__c,additional_testing__c,Spec_Description__c,Smoker__c,Unit_Cost_Price__c,Discount,CurrencyISOCode,
        IsDeleted , PricebookEntry.Name, PricebookEntry.Product2id,  Shipping_Cost__c, PricebookEntry.Product2.recordtype.name, PricebookEntry.Product2.Part_Id__c
        From OpportunityLineItem 
        where OpportunityId = :quote.Opportunity__c and product_sector__c = 'Primary Cells'];
        }

Thanks.
I have created a custom object called "Revenue_Reports__c" and gave it 4 record types for 4 different profiles. The record type are named as
1. FSAL
2. ISAL
3. National Mgr
4. Regional Mgr.

When an user selects any of the above record type the user should be navigated to the new visualforce page. How can I do this. 
Any help is appreciated.

Thanks. 
Hello Community,

Can I have 2 standard controller on a single visualforce page. If yes, Can someone explain. If not, Can someone explain me what is the use of multiple extensions.
Hello,

I am trying to insert a profile called "Vendor Partner Portal" for a user in my test class. When I run the tests I am getting an error message saying  System.DmlException: Insert failed. First exception on row 0; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): User, original object: Product_Line__c: []

Stack Trace: Class.Test_salesQuotes.runasPartner: line 230, column 1
Below is my code. Can someone help me find what the issue is
 
@isTest()
public class Test_salesQuotes{
public static testmethod void method1(){

//Method 1
      // To begin, the sample application first creates the necessary records
      // to test OpportunityLineItems: Pricebook2, Product2, and PricebookEntry
      // First it creates a product with a standard price
      Product2 p = new product2(name='gack',isActive=true);
      insert p;
      Id pricebookId = Test.getStandardPricebookId();
      
      try{
        insert new PricebookEntry(pricebook2id = pricebookId, product2id = p.id, 
                                unitprice=1.0, isActive=true);
      }catch(System.DMLException e){
        //Swallow exception.. Trigger should have already created the Standard PB entry for this product.
      }
      
      // Next, it creates a new pricebook with an entry for this product
      Pricebook2 pb = new pricebook2(name='test', Ext_Ref_Id__c='asldfjlakjsdf234234');
      insert pb;
      PricebookEntry pbe = new PricebookEntry(pricebook2id=pb.id, product2id=p.id, 
                                              unitprice=1.0, isActive=true);
      insert pbe;
      // To test the first example from the sample application, the test
      // method creates an opportunity line item using the pricebook entry,
      // and then asserts that the Color field was correctly copied from the
      // product after record insertion.
      Opportunity o = new Opportunity(name='test', pricebook2id=pb.id,
      stageName='Open', CloseDate=Date.newInstance(2006,10,10));
      insert o;
      OpportunityLineItem oli = new OpportunityLineItem(opportunityid=o.id, 
                                pricebookentryid=pbe.id, unitprice=1.5, quantity=2);
      insert oli;
    
      // To test the fifth example from the sample application, the test method
      // creates a primary quote and then asserts that its Primary field cannot
      // be deselected. The code uses the try...catch testing idiom to assert
      // that the error message is correct.
      SFDC_520_Quote__c q = new SFDC_520_Quote__c(opportunity__c = o.id, primary__c = true);
      insert q;    
}

//Method2
  
  static testmethod void t1() {
    SFDC_520_Quote__c q = new SFDC_520_Quote__c(); 
    insert q; 
    salesQuotes s = new salesQuotes( new ApexPages.StandardController(q ) );
          
  }

//Method3
   public static  testMethod  void test1() {
      Product_Line__c pl = new Product_Line__c(name = 'myPL');
      insert pl;     

     Product2 p = new product2(name='gack',family='gack',productcode='gack',Product_Line__c=pl.Id,isActive=true);
      insert p;
       
       Product2 p3 = new product2(name='gack',family='gack',productcode='gack',Product_Line__c=pl.Id,isActive=true);
       p3.Loanable__c=true;
      insert p3;
      
      Id pricebookId = Test.getStandardPricebookId();
      
      try{
          insert new PricebookEntry(pricebook2id = pricebookId, product2id = p.id, 
                                unitprice=1.0, isActive=true);
      }catch(System.DMLException e){
        //Swallow exception - creating the product2 should have created a standard 
        //PricebookEntry already.
      }    
        // Next, it creates a new pricebook with an entry for this product
        Pricebook2 pb = new pricebook2(name='test', Ext_Ref_Id__c='asldfjlakjsdf234234');
        insert pb;
        PricebookEntry pbe = new PricebookEntry(pricebook2id=pb.id, product2id=p.id, 
                                              unitprice=1.0, isActive=true);
        insert pbe;
               
        Opportunity o = new Opportunity(name='test', pricebook2id=pb.id,
        stageName='Open', CloseDate=Date.newInstance(2006,10,10));
        insert o;
        OpportunityLineItem oli = new OpportunityLineItem(opportunityid=o.id, 
                                pricebookentryid=pbe.id, unitprice=1.5, quantity=2);
        insert oli;
        
    SFDC_520_Quote__c q = new SFDC_520_Quote__c(Opportunity__c = o.id); 
    insert q;
     
     id VendorPQRecordType = [select Id FROM RecordType where Name = 'Primary Cells Request'].Id;
       
      SFDC_520_Quote__c q1 = new SFDC_520_Quote__c(Opportunity__c = o.id); 
      q1.recordtypeid=VendorPQRecordType;
     insert q1; 
    
    PageReference pageRef = Page.AddQuoteLines;
        Test.setCurrentPage(pageRef);
      system.debug( 'quote id is '+q.id);
      
      ApexPages.currentPage().getParameters().put('id', q.id);
      
     salesQuotes s = new salesQuotes();
     ApexPages.currentPage().getParameters().put('reloadQuote','1');
       
     ApexPages.currentPage().getParameters().put('id', q1.id);
      
     salesQuotes s1 = new salesQuotes();
     ApexPages.currentPage().getParameters().put('reloadQuote','1');
       
     ApexPages.currentPage().getParameters().put('userTypeName', null);
       
     system.assertEquals('Standard',s1.UserTypeName);
     
     s1.CopyOperation(); 
     s.CopyOperation();
     
     s.save(  ) ;
     system.debug ( s.total );
     
     ApexPages.currentPage().getParameters().put('pid', p.id);
     s.enableAddProducts();
     s.searchStr='g';
     s.doSearch(); 
     Id [] fixedSearchResults= new Id[1];
         fixedSearchResults[0] = p.id;
         Test.setFixedSearchResults(fixedSearchResults);
     
     s.searchStr = 'gac';
     s.sortField = 'Product_Line__c';
     s.doSearch();
     
     try { s.addProd();
       // search does not find products inserted by test?
     } catch( System.NullPointerException npe) {
     }
     
     s.copyAndEdit();
 //  s.queryQuoteLines( s.quote.id); 
     s.recalc();
     
     s1.copyLineItemsFromQuoteToOppty();
       
     Account acct = test_standardobjectutil.createAccount('Test Account', false);
    // acct.IsPartner=true;
     insert acct;
       
     Contact c = test_standardobjectutil.createContact('John','Doe2', false);
     c.accountid = acct.Id;
     insert c;                  
   }

    /* Method 4*/
    
    public static  testMethod  void runasPartner() {
         
         Product_Line__c pl = new Product_Line__c(name = 'myPL');
      insert pl;     

     Product2 p = new product2(name='gack',family='gack',productcode='gack',Product_Line__c=pl.Id,isActive=true);
      insert p;
       
       Product2 p3 = new product2(name='gack',family='gack',productcode='gack',Product_Line__c=pl.Id,isActive=true);
       p3.Loanable__c=true;
      insert p3;
  Id pricebookId = Test.getStandardPricebookId();     
      try{
          insert new PricebookEntry(pricebook2id = pricebookId , product2id = p.id, 
                                unitprice=1.0, isActive=true);
      }catch(System.DMLException e){
        //Swallow exception - creating the product2 should have created a standard 
        //PricebookEntry already.
      }
      
        Pricebook2 pb = new pricebook2(name='test', Ext_Ref_Id__c='asldfjlakjsdf234234');
        insert pb;
        PricebookEntry pbe = new PricebookEntry(pricebook2id=pb.id, product2id=p.id, 
                                              unitprice=1.0, isActive=true);
        insert pbe;
     
       Opportunity o = new Opportunity(name='test', pricebook2id=pb.id,
        stageName='Open', CloseDate=Date.newInstance(2006,10,10));
        insert o;
        OpportunityLineItem oli = new OpportunityLineItem(opportunityid=o.id, 
                                pricebookentryid=pbe.id, unitprice=1.5, quantity=2);
        insert oli;
        
     SFDC_520_Quote__c q = new SFDC_520_Quote__c(Opportunity__c = o.id); 
    insert q;
   
      id VendorPQRecordType = [select Id FROM RecordType where Name = 'Primary Cells Request'].Id;
        
       SFDC_520_Quote__c q1 = new SFDC_520_Quote__c(Opportunity__c = o.id); 
         q1.recordtypeid=VendorPQRecordType;
     insert q1;
     
    PageReference pageRef = Page.AddQuoteLines;
        Test.setCurrentPage(pageRef);
      system.debug( 'quote id is '+q.id);
      
      ApexPages.currentPage().getParameters().put('id', q.id);
      
     salesQuotes s = new salesQuotes();
     ApexPages.currentPage().getParameters().put('reloadQuote','1');
       
     ApexPages.currentPage().getParameters().put('id', q1.id);
      
     salesQuotes s1 = new salesQuotes();
     ApexPages.currentPage().getParameters().put('reloadQuote','1');
       
     ApexPages.currentPage().getParameters().put('userTypeName', null);
       
     system.assertEquals('Standard',s1.UserTypeName);
     
        Account acct = test_standardobjectutil.createAccount('Test Account', false);
    // acct.IsPartner=true;
     insert acct;
       
     Contact c = test_standardobjectutil.createContact('John','Doe2', false);
     c.accountid = acct.Id;
     insert c;  
     
     Profile userProfile = [SELECT Id FROM Profile WHERE Name='Vendor Partner Portal']; 
     User u = new User(Alias = 't23', Email='teststandarduser@stemcell.com', 
     EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', 
     LocaleSidKey='en_US', ProfileId = userProfile.Id,
     ContactId = c.id,
     TimeZoneSidKey='America/Los_Angeles', UserName='teststandarduser@stemcell.com');
     insert u;
        system.runAs(u){
            
            ApexPages.currentPage().getParameters().put('pid', p.id);
             s.enableAddProducts();
             s.searchStr='g';
            system.debug('Test exact user:'+ u); 
            s.doSearch(); 
        }
   }
   }

 
I have trouble comparing old and new Account OwnerID. I see an error message saying  "Error: Compile Error: Invalid field OwnerId for SObject User at line 13 column 46". Below is my code. Please assist.
 
trigger ContactOwnerID on Account (After Insert, After Update) {

List<Account>AccList = new List<Account>();
Map<id,user>OldUserMap = new Map<id,user>();
Map<id,user>NewUserMap = new Map<id,user>();
List<Contact>ConList = new List<Contact>();
List<Contact>UpdatedConList = new List<Contact>();
List<Contact>FinalConList = new List<Contact>();



For(Account A:Trigger.new){
If(A.OwnerId != Null && OldUserMap.get(A.id).OwnerId != NewUserMap.get(A.id).OwnerId){
AccList.add(A);
}
If(!AccList.isEmpty()){
ConList =[Select id, OwnerId, AccountId from Contact where AccountId =: AccList];
}
}
If(!ConList.isEmpty()){
For(Contact c:UpdatedConList){
c.OwnerId = c.account.ownerid;
FinalConList.add(c);
}
}
If(!FinalConList.isEmpty()){
Update FinalConList;
}
}

 
I have 2 triggers calling 2 different handler classes on the same object . As part of best practise I want to call both the classes from a single trigger. I am not sure how to call them. Below are my two triggers.
 
trigger ShippingAddress on Shipping_Address__c (after delete, 
                             after insert,  
                             after undelete, 
                             after update, 
                             before delete, 
                             before insert, 
                             before update ) {
    try  
    {
        ITriggerHandler handler = new SingleTriggerHandler (
                                        new ShippingAddressTriggerHandler(),
                                        Trigger.isExecuting,
                                        Trigger.isInsert, 
                                        Trigger.isUpdate, 
                                        Trigger.isDelete, 
                                        Trigger.isBefore, 
                                        Trigger.isAfter, 
                                        Trigger.isUndelete, 
                                        Trigger.new, 
                                        Trigger.newMap, 
                                        Trigger.old, 
                                        Trigger.oldMap, 
                                        Trigger.size );
        handler.process(); 
    }
    catch (AbstractTriggerHandler.InvalidTriggerInvocationException itie)
    {
        SystemExceptionLogger.insertSystemExceptionLogEntry(
                                        itie, 
                                        'Shipping Address Application - Common Use', 
                                        'Shipping Address Trigger', 
                                        SystemExceptionLogger.EXCEPTION_LEVEL_INFO);
        
    }
    catch (Exception e)
    {
        SystemExceptionLogger.insertSystemExceptionLogEntry(
                                        e, 
                                        'Shipping Address Trigger Application - Common Use', 
                                        'Shipping Address Trigger', 
                                        SystemExceptionLogger.EXCEPTION_LEVEL_CRITICAL);
        throw e;
    }

}
Trigger 2
trigger StagingShippingAddress on Shipping_Address__c (after delete, 
                             after insert,  
                             after undelete, 
                             after update, 
                             before delete, 
                             before insert, 
                             before update ) {
    try  
    {
        ITriggerHandler handler = new SingleTriggerHandler (
                                        new StagingShippingTriggerHandler(),
                                        Trigger.isExecuting,
                                        Trigger.isInsert, 
                                        Trigger.isUpdate, 
                                        Trigger.isDelete, 
                                        Trigger.isBefore, 
                                        Trigger.isAfter, 
                                        Trigger.isUndelete, 
                                        Trigger.new, 
                                        Trigger.newMap, 
                                        Trigger.old, 
                                        Trigger.oldMap, 
                                        Trigger.size );
        handler.process(); 
    }
    catch (AbstractTriggerHandler.InvalidTriggerInvocationException itie)
    {        SystemExceptionLogger.insertSystemExceptionLogEntry(itie,'Shipping Address Application - Common Use','Shipping Address Trigger',SystemExceptionLogger.EXCEPTION_LEVEL_INFO);
        
    }
    catch (Exception e)
    {        SystemExceptionLogger.insertSystemExceptionLogEntry(e,'Shipping Address Trigger Application - Common Use','Shipping Address Trigger',SystemExceptionLogger.EXCEPTION_LEVEL_CRITICAL); throw e;
    }

}


 
Can someone tell me why is this error message occuring and how can i solve it.
 
<apex:column style="vertical-align: text-top;" headerValue="Unit Price" rendered="{! AND(OR( $ObjectType.SFDC_520_QuoteLine__c.Fields.Unit_Price__c.createable, $ObjectType.SFDC_520_QuoteLine__c.Fields.Unit_Price__c.updateable), SFDC_520_Quote__c.recordtype.name!='Custom Quotation' ) }">
                        <apex:inputField required="true" value="{!item.quoteline.Unit_Price__c}" onchange="sayHello();" />
                    </apex:column>

 
I am encountering below error when trying to deploy the a class. Below is error and class. I am not sure why i get this error.

error is 
No such column 'Single_Donor__c' on entity 'OpportunityLineItem'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

 
if(quoteRecordtype=='Primary Cells Request'){ 
        olist = [Select Id, OpportunityId, SortOrder, PricebookEntryId, Quantity,ETA__c, 
        TotalPrice, UnitPrice, ListPrice, ServiceDate, Description, CreatedDate, 
        CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp, Sales_Discount__c,opportunity.recordtype.name,
        Age__c,Anticoagulant__c,Cell_Isolation__c,Cells_per_Vial__c,Multiple_Donors__c,Single_Donor__c,Product_State__c,Desired_Cell_type__c,
        Donor_Blood_Type__c,End_Age__c,Ethnicity__c,Gender__c,Healthy_Tissue_Type__c,Product_Specifications__c,
        Medication_Constraints__c,Other_Info__c,Medication_Constraints_Other__c,Specific_Donor_s__c,HLA_Type__c,ADCC_Status__c,
       Other_Requirements__c,additional_testing__c,Spec_Description__c,Smoker__c,Unit_Cost_Price__c,Discount,CurrencyISOCode,
        IsDeleted , PricebookEntry.Name, PricebookEntry.Product2id,  Shipping_Cost__c, PricebookEntry.Product2.recordtype.name, PricebookEntry.Product2.Part_Id__c
        From OpportunityLineItem 
        where OpportunityId = :quote.Opportunity__c and product_sector__c = 'Primary Cells'];
        }

Thanks.