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
Ben Merton 17Ben Merton 17 

Using a text formula from Custom Metadata in Apex

Is it possible to create a text field in Custom Metadata which contains a formula that can then be used in Apex.

I am trying to build a simple tax engine that would refer to metadata fields.  A metadata record would look like this:

Name:  Sales_Tax
Input Variables:  Basic_Price, Sales_Tax_Rate
Output Variable:  Sales_Tax_Amount
Formula:  Sales_Tax_Amount = Basic_Price*Sales_Tax_Rate

Then I would call this into an Apex trigger that updates a field with the Sales_Tax_Amount
Dario BakDario Bak
This can't be done, sorry
Ben Merton 17Ben Merton 17
This really has to be one of the most annoying ways to answer a question.  It means that it is now less likely that someone is going to come in and give a decent explanation.

Is there NOTHING I can do to achieve this result?  For example, using the Tooling / Metadata API to parse out the text field??

You mean that this can't be done even if I build a competely external system that is able to achieve this?  Let's say I want to invest USD 1 billion dollars into finding a solution to this problem?   Even then, it can't be done??

If you can't answer properly, please don't answer at all as it just means that the question gets deprioritised