• Lucky
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
Hi I created a visualforce page for selecting certain recordtypes to over write standard record type selecting page. For that controller I got stuck with writing test class. Please help anybody for this.
public with sharing class SelectSORRecordTypeCntrl{
Public List<RecordType> RecList{get; set;}
public Id recordTypes1{get;set;}
public string AcName{get; set;}
public string AcId{get; set;}

    public SelectSORRecordTypeCntrl() {
RecList=[SELECT id,Name, DeveloperName FROM RecordType 
                        WHERE DeveloperName in('Address_Changes_MMI','Billing_Terms_ETS','Billing_Terms_MMI','Billing_Terms_WMI8Credits_ETS','Credits_MMI','Credits_WMI','Customer_Service_General_ETS','Customer_Service_General_MMI','Customer_Service_General_WMI','Insurance_Forms_ETS','Insurance_Forms_MMI','Insurance_Forms_WMI','Lein_Release_Request_ETS','Lein_Release_Request_MMI','PO_Request_MMI','Pickup_Request_MMI','Tax_Exemption_MMI')];
AcName = ApexPages.currentPage().getParameters().get('Name');
AcId = ApexPages.currentPage().getParameters().get('id');
}
String[] ps= new String[]{};
 public String[] getrecordTypes() {
    return ps;
  }

  public void setrecordTypes(String[] ps) {
    this.ps = ps;
  }
  

  public List<SelectOption> getItems() {
    List<SelectOption> op = new List<SelectOption>();
    for(RecordType p : [SELECT id,Name, DeveloperName FROM RecordType 
                        WHERE DeveloperName in('Address_Changes_MMI','Billing_Terms_ETS','Billing_Terms_MMI','Billing_Terms_WMI8Credits_ETS','Credits_MMI','Credits_WMI','Customer_Service_General_ETS','Customer_Service_General_MMI','Customer_Service_General_WMI','Insurance_Forms_ETS','Insurance_Forms_MMI','Insurance_Forms_WMI','Lein_Release_Request_ETS','Lein_Release_Request_MMI','PO_Request_MMI','Pickup_Request_MMI','Tax_Exemption_MMI')])
    op.add(new SelectOption(p.Id, p.Name));
    return op;
    }
  public Pagereference navigate()
  {
   Pagereference  p = new Pagereference('/a0d/e?retURL=%2Fa0d%2Fo&ent=01I80000000lLBL&RecordType='+recordTypes1+'&CF00N80000004mJY7='+AcName);
   P.setRedirect(true);
   return p;
  }
public Pagereference NavBack()
  {
   Pagereference  b = new Pagereference('/apex/AccountDashboard?id='+AcId);
   b.setRedirect(true);
   return b;
  }

}
Thanks in Advance
 
  • November 17, 2015
  • Like
  • 0
Hi I want to convert following IF condition to CASE in Formula field. Please Help me out..
IF(( RecordType.Name  = "Business Account") && (BillingCountry  != "CAN"),Text(1000),IF(( RecordType.Name  = "Business Account") && (BillingCountry  = "CAN"),Text(1100),IF(( RecordType.Name  = "Business Account - UK"),Text(1200),IF(( RecordType.Name  = "ETS/WMI") &&   CONTAINS(OwnerId__r.Profile.Name, "ETS"),Text(1500),IF(( RecordType.Name  = "ETS/WMI") &&   CONTAINS(OwnerId__r.Profile.Name, "WMI"),Text(1501),IF(( RecordType.Name  = "Residential Account") && (BillingCountry  != "CAN"),Text(1000),IF(( RecordType.Name  = "Residential Account") && (BillingCountry  = "CAN"),Text(1100),IF(( RecordType.Name  = "Residential Account - UK"),Text(1200),null))))))))
Thanks in Advance.
 
  • November 11, 2015
  • Like
  • 0