How to start renumbering every day in Salesforce?

Sample Trigger:

trigger MemberTrigger on Member__c (before insert) {
    Integer count = 0;
    List<Member__c> listMember = new List<Member__c>();
    listMember = [SELECT Id FROM Member__c WHERE CreatedDate > : System.today()];
    system.debug('Size is ' + listMember.size());   
    
    if(listMember.size() > 0){
        count = listMember.size();
    }

    for(Member__c mem : trigger.New){
        count += 1;
        mem.Today_s_Count__c = count;
    }
}

Output:



No comments:

Post a Comment