• Sravanthi G
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 34
    Questions
  • 3
    Replies
account object and account link object if account object is created account link object created automatically in that phone fieds populateautomatically how to remove country code whie saving account link with out countery code data has to save.what is the solution code.
i created opportunity record type and i delete the record type but it shows the record type Id how to delete that?

User-added image
public with sharing class SalesLeadController {
    
    
//To fetch opportunity details
    public Opportunity opp {get;set;}
    public Id recTypeId {get;set;}
    public string rec {get;set;}
  public boolean isHide {get;set;}
  public boolean isHidecomp {get;set;}
    public integer prefcount;
  public integer prefcountcomp;
    public integer i;
  public integer j;
  public static integer chk;
  public static integer chkcomp;
  //This is used for interested vehicle
    public list<Lead_Details__c> intVehicle {get;set;} 
    
    //This is used for competitor vehicle
    public list<Lead_Details__c> compVehc {get;set;} 
    
    //This is used for Trad in vehicle
    public list<Lead_Details__c> tradeVehc {get;set;}
    public list<Lead_Details__c> allVehicles = new list<Lead_Details__c>();
    
    public SalesLeadController(ApexPages.StandardController controller) {
        if(chk != 1)isHide = true;
    if(chkcomp != 1)isHidecomp = true;
    opp = new opportunity();
    recTypeId = UtilRecordType.getRecordTypeIdByName('Opportunity', System.Label.Sales_Lead);
        opp.RecordTypeId = recTypeId;
    
        intVehicle = new list<Lead_Details__c>();
        
        compVehc = new list<Lead_Details__c>();
        
        tradeVehc = new list<Lead_Details__c>();
    Lead_Details__c tld = new Lead_Details__c();
        tld.type__c = 'Trade In';
        tradeVehc.add(tld);
    }

    //To add more records for Interested Vehicle
    public PageReference AddIntRecord() {
        
        Lead_Details__c ld = new Lead_Details__c();
        ld.type__c = 'Interested';
    ld.Vehicle_Model_Type__c = 'Own Sellable';
        intVehicle.add(ld);
        return null;
    }
    
    //To add more records for Competitor Vehicle
    public PageReference AddCompRecord() {
        
        Lead_Details__c cld = new Lead_Details__c();
        cld.type__c = 'Competitor';
    cld.Vehicle_Model_Type__c = 'Competitor';
        compVehc.add(cld);
        return null;
    }
    
  public void UpdateModInfo(){
        set<id> carModel = new set<id>();
        allVehicles.addall(intVehicle);
        allVehicles.addall(compVehc);
        for(Lead_Details__c l :allVehicles){
            carmodel.add(l.Car_Model__c);
        }
        list<Car_Model__c> cml = [select id, brand__C,series__c,Colour__c,Trim__c from car_model__C where id in: carModel];
        for(Lead_Details__c l :allVehicles){
            for(Car_Model__c cm : cml){
                if(l.Car_Model__c == cm.id){
                    l.brand__C = cm.brand__C;
                    l.Class__c = cm.series__c;
                    l.color__c = cm.colour__c;
                    l.trim__C = cm.trim__c;
                }
            }
        }
    }
  
  public void PreferredChk(){
    chk = 1;
    prefcount = 0;
    isHide = true;
  system.debug('size'+intVehicle.size());
  if(intVehicle!=null && intVehicle.size()>0)
  {
        for(i=0;i<intVehicle.size();i++)
        {
            if(intVehicle[i].Preferred__c)
          {
                system.debug('i'+i);
                prefcount++;
            }
        }
        system.debug('prefcount: '+prefcount);
        if(prefcount>1)
        {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Cannot select more than one Preferred Interested Vehicle'));
            isHide = false;
        }
  }
  }
  
  public void PreferredChkComp(){
    chkcomp = 1;
    prefcountcomp = 0;
    isHidecomp = true;
      system.debug('size'+compVehc.size());
      if(compVehc!=null && compVehc.size()>0)
      {
        for(j=0;j<compVehc.size();j++)
        {
          if(compVehc[j].Preferred__c)
          {
            system.debug('j'+j);
            prefcountcomp++;
          }
        }
        system.debug('prefcountcomp: '+prefcountcomp);
        if(prefcountcomp>1)
        {
          ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Cannot select more than one Preferred Competitor Vehicle'));
            isHidecomp = false;
        }
      }
  }
    
    public pageReference saveOpp(){

        try{
            DMLManagerService.insertAsSystem(opp);
        }
        catch (DmlException e){
            ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error,e.getDMLMessage(0)));                                          
        }


        allVehicles = new list<Lead_Details__c>();
        //added for loops so that lead detail is not inserted if user oest not pick any model
    for(integer i=0;i<intVehicle.size();i++){
    system.debug('intmodel:' + intVehicle[i].Car_Model__c);
    if(intVehicle[i].Car_Model__c != null) allVehicles.addall(intVehicle);
    }
    for(integer i=0;i<compVehc.size();i++){
    system.debug('comptmodel:' + compVehc[i].Car_Model__c);
    if(compVehc[i].Car_Model__c != null) allVehicles.addall(compVehc);
    }
        for(integer i=0;i<tradeVehc.size();i++){
    system.debug('trademodel:' + tradeVehc[i].Car_Model__c);
    if(tradeVehc[i].Trade_In_Vehicle__c != null) allVehicles.addall(tradeVehc);
    }
        
        for(Lead_Details__c l :allVehicles){
            l.Related_Lead__c = opp.id;
        }
        try{
            Insert allVehicles;
        }
        catch(DmlException e){
            ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error,e.getDMLMessage(0)));                                          
        }

        
        PageReference oppPage = new ApexPages.StandardController(opp).view();
        oppPage.setRedirect(true);
        return oppPage;
    }
    public pageReference Cancel(){
            PageReference pageRef; 
        pageRef = new PageReference('/006/o');

        return PageRef;
    }

}
 
public with sharing class AfterSalesLeadEditController {
    
    //This map is used for all vehicles
    public map<String, List<Lead_Details__c>> allVehiclesMap {get;set;}
    //This map is used for all vehicles
    public List<Lead_Details__c> allVehiclesList {get;set;}
    //To fetch opportunity details
    public Opportunity opp {get;set;}
    // Constructor
    public AfterSalesLeadEditController(ApexPages.StandardController controller) {
        allVehiclesMap = new Map<String,List<Lead_Details__c>>();
        allVehiclesList = new List<Lead_Details__c>();
        opp=[SELECT id,Name ,RecordType.Name,StageName,Case__c,CreatedDate,Campaign.Name,Visited_Showroom_Date_Time__c,Market__c, Type_of_Sale__c,
             Lead_Additional_Service__c,Pickup_Date_Time__c,Order_Placed_Date__c,Quotation_Date__c,Quotation_Amount__c,Order_No__c,
             Order_Print_Date__c,Order_Confirmation_Date__c,Registration_No__c,Network_Registration_Date__c,Bought_Vehicle_Brand__c,Next_Contact_Customer_Date__c,
             Bought_Vehicle_Class__c,Bought_Vehicle_Model__c,Invoice_Number__c,Invoice_Date__c,Purchase_Time__c,Received_Date_Time__c,
             Invoice_Amount__c,Qualified_Date_Time__c,UCID__c,Desired_Contact_Date__c,Price_Range__c,Test_Drive_Date__c,Preferred_Contact_Time__c,Assigned_Service_Advisor__c,
             Accepted_Date_Time__c,Purchase_Date__c,Quotation_Print_Date__c,Quotation_No__c,Assigned_Date_Time__c,Preferred_Contact_Method__c,
             Lead_Latest_Phase__c,Contact__c,Sales_Consultant__c,Dealer_Comment__c,Customer_Preferred_Representative__c,
             Customer_Specified_Dealer__c,Lead_Type__c,Assigned_Dealer__c,CloseDate,Lead_Sub_Type__c,Lead_DataSource__c,Handover_Date__c,
             CAC_Lost_Reason__c,Lead_DataSubSource__c,Lost_Reason_text__c,Lead_Desired_Service__c,Last_Successful_Call__c,
             Lead_Source__c,Lead_Priority__c,Lost_To__c,Lost_Situation__c FROM opportunity WHERE Id =: ApexPages.currentPage().getParameters().get('id')];
                
        for(Lead_Details__c ld : [Select Id, recordTypeId, Brand__c, Car_Model__c, Class__c, Color__c, Market__c, Mileage__c, Preferred__c, Related_Lead__c, Trade_In_Vehicle__c, Trim__c, Type__c, Vehicle_Model_Type__c, Year_of_Manufacture__c From Lead_Details__c Where Related_Lead__c =: ApexPages.currentPage().getParameters().get('id')]){
            // Add vehicles separately
            String leadDetailRecordTypeName = UtilRecordType.getRecordTypeNameById('Lead_Details__c', ld.RecordTypeId);
            if(!allVehiclesMap.isEmpty() && allVehiclesMap.containsKey(leadDetailRecordTypeName)){
                List<Lead_Details__c> tempLdList = allVehiclesMap.get(leadDetailRecordTypeName);
                tempLdList.add(ld);
                allVehiclesList.add(ld);
                allVehiclesMap.put(leadDetailRecordTypeName, tempLdList);
            }
            else{
                allVehiclesList.add(ld);
                allVehiclesMap.put(leadDetailRecordTypeName, new List<Lead_Details__c>{ld});
            }
        }
    }
    // Populate vehicles on edit page
    public List<Lead_Details__c> getIntVehicles(){
        System.debug('allVehiclesMap==>' + allVehiclesMap);
        if(!allVehiclesMap.isEmpty())
            return allVehiclesMap.get('Interested Vehicle');
        return null;
    }
    public List<Lead_Details__c> getCompVehicles(){
        System.debug('allVehiclesMap==>' + allVehiclesMap);
        if(!allVehiclesMap.isEmpty())
            return allVehiclesMap.get('Competitor');
        return null;
    }
    public List<Lead_Details__c> getTradeInVehicles(){
        System.debug('allVehiclesMap==>' + allVehiclesMap);
        if(!allVehiclesMap.isEmpty())
            return allVehiclesMap.get('Trade In');
        return null;
    }
    
    public void UpdateModInfo(){
        set<id> carModelIdSet = new set<id>();
        for(Lead_Details__c leDetail : allVehiclesList){
            carModelIdSet.add(leDetail.Car_Model__c);
        }
        list<Car_Model__c> cmList = [select id, brand__C,series__c,Colour__c,Trim__c from car_model__C where id in: carModelIdSet];
        for(Lead_Details__c ld : allVehiclesList){
            for(Car_Model__c cm : cmList){
                if(ld.Car_Model__c == cm.id){
                    ld.brand__C = cm.brand__C;
                    ld.Class__c = cm.series__c;
                    ld.color__c = cm.colour__c;
                    ld.trim__C = cm.trim__c;
                }
            }
        }
    }
    
    public pageReference saveOpp(){
        Update opp;
        /*
        for(Lead_Details__c l :allVehiclesList){
            l.Related_Lead__c = opp.id;
        }
        Insert allVehiclesList;
        */
        PageReference oppPage = new ApexPages.StandardController(opp).view();
        oppPage.setRedirect(true);
        return oppPage;
    }
}
Primary_Address_Reference_Not_Editable
is the validation rule 
fiekds:
if  reatil dmscustomer id is not blank and primary address reference is changed trow an error message
here this is in accountlink object 

retail dms customer id is account link  field

and primary address referecnce is in account(c)  lookup field of address object(p)
how to create
please help me
ISBLANK( Retail_DMS_Customer_ID__c)
how to create for ischanged with lookup primary address reference field









 
Work Phone should be in the following Format  +91-0XX-XXXXXXXX for validation rule how to craete
how to create the field lookup in lightning  page ?can populate values in lightning page how?
If Account has 10 Contacts then in Contact checkbox field active then the account checkbox also active ?(primary account) how to createe trigger
if inactive
if Account has 10 Contacts then in Contact checkbox field inactive then the account checkbox also inactive?
If Account has 10 Contacts then in Contact checkbox field inactive then the account checkbox also inactive ?(primary account) how to create trigger?
 
the web page should have a search bar preferably with placeholder text enter city name and a search buttoon ?the user can enter a city name and on click of search button the page shoud display latitude ,longitide and formatted address.on click of a save button the details should be saved to a custom object record .there should be no duplicate record for a particular city?how to do solution in visualforce page and apex class
I am logged in user as org ? the limit is daily 15 records?, i want to create 16 th record the system throws an error, how to solve that error? if  i want to create  16 th record how?
if there is duplicate records in object?how to delete that duplicates with same name?
iam geeting errror in bacth class ?Invalid conversion from runtime type Contact to Lead?
how to update two different objects data in batch class? Lead & Contact standard objects to update email
how to visible that mass mail merge in tools   for contact  tab in salesforce
how to enable the mass mail merge tool for contact in salesforce
how to send the record link  for community user through workflow email alert? based on lookup field how ? solution?
How to refresh the Parent page when we update the child page in detail page
I have creating one application , i want to do resume parsing with  tool & how to implement in salesforce? 
In pageblock table data is comming butUser-added image in hide link ?if i click link the record data  has to hide how?give me solution
If Account has 10 Contacts then in Contact checkbox field inactive then the account checkbox also inactive ?(primary account) how to create trigger?
 
manage currencies option is not there to enable ? how to create?
solution
it is developer edition? how to create ?User-added image
In our Organisation , In  company Information we are not able to Visible the  currency field ?.solution how to enable the currency field .