I will share my Apex in this blog, for complete configuration you can checkout my vlog below :
Apex
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | public class UpdateConvertedContact { @InvocableMethod public static void updateContact(List<String> contactIds){ Double roundRobinValue = 1; Contact con=[SELECT Id, Round_Robin_ID__c FROM Contact where Id in:contactIds]; List<Contact> conList = [SELECT Id, Round_Robin_ID__c, CreatedDate FROM Contact where Round_Robin_ID__c != null order by CreatedDate desc limit 1]; if(conList != null && conList.size()>0){ if(conList[0].Round_Robin_ID__c != 2){ roundRobinValue = conList[0].Round_Robin_ID__c +1; } else{ roundRobinValue = 1; } } con.Round_Robin_ID__c = roundRobinValue; update con; } } |
Checkout the vlog below
If you have any question please leave a comment below.
If you would like to add something to this post please leave a comment below.
Share this blog with your friends if you find it helpful somehow !
Thanks
Keep Coding
0 Comments