Skip to main content
Amber Gillis (K2M) ha fatto una domanda in #Data Management
How can we modify a numbering scheme based on a Case Record Type?  Can we import/override the Case# already on a record?
2 risposte
  1. 26 nov 2013, 15:02
    Hi Smith,

     

    YOu can try this trigger...can create a autonumber based on specific recordtype....

     

    Create a Custom Field by number datatype for each recordtype and use this trigger...

     

    trigger AutonumberOnlyRecType2 on Invoice__c (before insert, before update)

     

    {

     

    list<Invoice__c> l= [SELECT Id,Name,C_Autonumber_RT2__c FROM Invoice__c where C_Autonumber_RT2__c !=:null order by C_Autonumber_RT2__c desc limit 1];

     

    decimal maxlead = l[0].C_Autonumber_RT2__c;

     

       for(Invoice__c li:Trigger.new) {

     

       if(li.RecordTypeId == '01290000000Wuvl'){

     

      

     

        li.C_Autonumber_RT2__c = Integer.valueOf(maxlead)+1;

     

        } 

     

       }

     

    }

     

    I hope this helps...let us know by marking the answer as "Best Answer" right under the comment Only if it helps....This will help the rest of the community should they have a similar issue in the future.  Thank you!

     

    Regards

     

    Aroooonn!!
0/9000