How to Execute Apex Code Dynamically From Custom Metadata



Custom metada name : List <Trigger_Action_Logic__mdt> trlist= Trigger_Action_Logic__mdt.getAll().values();    

//   date field calling dynamicalling from custom metadata

Date dt = date.valueof(wo.get(trlist[0].Logic_Text__c));

                    system.debug('dt-'+dt); 

                 // With below code we are converting date to datetime

                    Integer d =dt.day();

                    Integer mo = dt.month();

                    Integer yr = dt.year();  

                    DateTime WoSMdate = DateTime.newInstance(yr, mo, d);

                    system.debug('WoSMdate-'+WoSMdate);

                    string SaDuedate = trlist[0].Variable_Name__c;

                    system.debug('SaDuedate-'+SaDuedate);

                    SA.put(SaDuedate,WoSMdate);  

Post a Comment

0 Comments