• Ashoka
  • NEWBIE
  • 35 Points
  • Member since 2016
  • Application Developer
  • Fujitsu

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 5
    Replies
Hello,

If a object has many record types available then it gives a choice to select a record type and it always point to default record type.
I want that instead of pointing to default record type it should point to blank like "select" like the picklist but the choosing of the picklist should be mandatory.

thanks for suggestion
  • July 18, 2016
  • Like
  • 0
Hi ,

in this trigger i have all are number datat tyype fileds.
trigger ParentCaseGBOAge on Case ( after update) 
{

    Set<Id> recordIds = new Set<Id>();
    Set<Id> parentIds = new Set <Id>();
       
    for (case c : Trigger.new)
        
        if( AvoidRecursion.isFirstRun())
    {
        if ( c.RecordTypeId == Schema.Sobjecttype.case.getRecordTypeInfosByName().get('GBOCase').getRecordTypeId() && c.parentid == null && c.status == 'Closed')
             {
             parentIds.add(c.id);
             }
    }
    system.debug('@@@@'+ParentIds.size());
    if (parentIds.isEmpty() == false) 
      {
     
        //List <case> caseparent = [Select id, Parent_BDT_Case_Age__c,Parent_COM_Case_Age__c,Parent_LSR_Case_Age__c, Parent_PDT_Case_Age__c   from case where id in :ParentIds ];
        Map<ID,Case> ResultMap = new Map <ID,Case> ([Select id, Parent_BDT_Case_Age__c,Parent_COM_Case_Age__c,Parent_LSR_Case_Age__c, Parent_PDT_Case_Age__c   from case where id in :ParentIds ]);
       // Map<ID,Case> ResultMap = new Map <ID,Case> ();
        AggregateResult[] groupedResults = [select max(ParentID) ParentID, sum(BDT_Case_Age__c)childsum1, sum(COM_Case_Age__c) childsum2, sum(PDT_Case_Age__c) childsum3, sum(LSR_Case_Age__c) childsum4 from case  where parentid in :ParentIds or Id in:ParentIds];    
        for (AggregateResult Ar : groupedResults)
         {
           ID resultID = (ID)Ar.get('ParentID');
           case cupd = ResultMap.get(resultID);
           cupd.Parent_BDT_Case_Age__c = (Decimal) Ar.get('childsum1');
         cupd.Parent_COM_Case_Age__c = (Decimal) Ar.get('childsum2');            
           cupd.Parent_PDT_Case_Age__c = (Decimal) Ar.get('childsum3');
           cupd.Parent_LSR_Case_Age__c = (Decimal) Ar.get('childsum4');
           //Resultmap.remove(resultID);
           ResultMap.put(resultID,cupd); 
           system.debug('$$$$$$' + ResultMap.values());  
           system.debug('^^^^'+cupd.Parent_BDT_Case_Age__c);  
        }   
      
              
  
        if(ResultMap.values().size() > 0)
        {  
           List <Case> CasestobeUpdated = new List <Case>();
            for (Case cu : [Select id, Parent_BDT_Case_Age__c,Parent_COM_Case_Age__c,Parent_LSR_Case_Age__c, Parent_PDT_Case_Age__c   from case where id in :ResultMap.keySet()]  )
            {
                cu.Parent_BDT_Case_Age__c = ResultMap.get(cu.id).Parent_BDT_Case_Age__c;
                cu.Parent_COM_Case_Age__c = ResultMap.get(cu.id).Parent_COM_Case_Age__c;
                cu.Parent_PDT_Case_Age__c = ResultMap.get(cu.id).Parent_PDT_Case_Age__c;
                cu.Parent_LSR_Case_Age__c = ResultMap.get(cu.id).Parent_LSR_Case_Age__c;
                CasestobeUpdated.add(cu);
            }
           
            update CasestobeUpdated;
         
         //  upsert ResultMap.values() ID ;
         //   system.debug('$$$$$ '+ResultMap.size());
        }   

    }
}
chnati
Cheers!!
Hello,

If a object has many record types available then it gives a choice to select a record type and it always point to default record type.
I want that instead of pointing to default record type it should point to blank like "select" like the picklist but the choosing of the picklist should be mandatory.

thanks for suggestion
  • July 18, 2016
  • Like
  • 0
Hi,

I am creating a vf page on which i need to show account,opportunity and opportunity contact role with a checkbox and a custom button(Clone). I need to clone all the selected records after click on this button.

I am new to Salesforce and have worked on this functionality for a long time. I would really appreciate your help on this functionaly. 
 
Hi Guys..!!

I Have a query, can we integrate Truecaller with Salesforce..??