function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDCmack08180939826349907SFDCmack08180939826349907 

I would like to know if we can create a field to store code inside the field, then execute that code from the field on a child object.

My goal is to store Apex code in a parent object ex. Account that has code in a long text area field and has a picklist with operation ex Update or Insert. The code will execute in the child code ex. Case and so will the operation.  
 
Account sa=[select id,Code_Text_field__c,operation_picklist__c from Account where id='001i000001zbIZR'];
Object CodeBlock=Code_Text_field__;
Object Operation=operation_picklist__c ;
 

Case c=[select id from Case where AccountId=:sa.id];
system.debug('CESAR@'+c);
CodeBlock;
Operation;

I understand the system is reading this as strings values, so how could I convert the Codeblack variable in Apex code and the Operation variable in DML statement?
SFDCmack08180939826349907SFDCmack08180939826349907
Account sa=[select id,Code_Text_field__c,operation_picklist__c from Account where id='001i000001zbIZR'];
Object CodeBlock=sa.Code_Text_field__;
Object Operation=sa.operation_picklist__c ;
Case c=[select id from Case where AccountId=:sa.id];
system.debug('CESAR@'+c);
CodeBlock;
Operation c;