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
AnushaAnusha 

Dynamic Logical Operations

Hi friends,

I have a requiremnt like,

there are 2 objects

BR

CN

 

And CN has a Lookup relationship with BR

 

Each BR may have more than one CNs;

On BR object one of the field will have some logic like below,

1 OR (2 AND 3)

 

FYI,

1, 2 and 3 are the CN records say some condition records

each condition record will have 3 fields like below,

Field Name              Operator                      Value

Status                        equals                         New

 

Now I need to perform validations from Apex.

Can someone help me ?

Thanks in advance.

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
AnushaAnusha

I got it,

Thanks for your support

All Answers

Satish_SFDCSatish_SFDC
If i have understood your requirements correctly, I dont think this is possible in Apex.
This involves parsing the logic in the BR Object. Parsing in itself is a complex subject. Also you have to take care of errors, What if there is a syntax error like missing parenthesis. And then you have to take care of precedence for complex logic involving many nested parenthesis.


Regards,
Satish Kumar
Please mark my answer as a solution if it was helpful so it is available to others as a proper solution.
If you felt I went above and beyond, please give me Kudos by clicking on the star icon.
AnushaAnusha

I got it,

Thanks for your support

This was selected as the best answer