Eval() Support For Apex Like JavaScript Eval() function. - Ideas - Salesforce Trailblazer Community
Trailblazer Community

All Ideas

Idea Details

Post an Idea
130  Points
Open - Not Planned
Open - Not Planned

Eval() Support For Apex Like JavaScript Eval() function.

Development (Apex, LWC & VF)

In JavaScript we have Eval() function which evaluates string like following

var x = 10;
var y = 20;
var a = eval("x * y") 

If we could get Evaluation support in apex then we can evaluate string as an Expression, which will be great help for developers.

Merge Idea · Flag

Latest Comment from Salesforce

  • Chris Peterson - 2 years ago

    While this is something that has valid use cases it also comes with a number of security implications that would seriously limit the utility of it.

    We can look into better integrating the formula engine to Apex in the future for math evaluation use cases, but a function for evaluating arbitrary Apex is not something we have plans to implement.
  • Upvotes
  • Downvotes



from AppExchange


No results found.

Help us to keep IdeaExchange clean by pointing out overlapping ideas. We'll investigate your suggestion and merge the ideas if it makes sense.



Thanks for your merge suggestion. We will review it shortly and merge the ideas if applicable.

Salesforce takes abuse situations very seriously. Examples of abuse include but are not limited to posting of offensive language or fraudulent statements. To help us process your request as quickly as possible, please fill out the form below describing the situation. For privacy and security reasons, the final outcome of an abuse case may not be revealed to the person who reported it.


Thank you for your feedback. We take abuse seriously and will investigate this issue and take appropriate action.