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
JoshTonksJoshTonks 

Im looking at the possibility of querying a pick list against a custom metadata to work out value

Hi,

Im looking to see if there are any tutorials around that shows you how to query a picklist field on an object against a metadata label and output the value of the custom metadata

Example 
Picklist Option
Term: 12 Month

So we would take the 12 Month from the picklist and look for 12 Month in custom metadata term number and then output the value of 12. It didnt used to be an issue however as our company will offer any length of term the formula we were using cannot hold all the term numbers. Which results in us having to update the Formula on a daily basis.

Ive tried to find a tutorial online cannot find anything so if anyone knows a tutorial along those lines I would be very grateful.

Many Thanks In Advance
 
Best Answer chosen by JoshTonks
johnseelewis42johnseelewis42
Where would you plan to do this?  Visualforce?  Lightning?  

Once I found the value, I would just query the custom metadata in an Apex block.

https://help.salesforce.com/articleView?id=custommetadatatypes_accessing.htm&type=5

All Answers

johnseelewis42johnseelewis42
Where would you plan to do this?  Visualforce?  Lightning?  

Once I found the value, I would just query the custom metadata in an Apex block.

https://help.salesforce.com/articleView?id=custommetadatatypes_accessing.htm&type=5
This was selected as the best answer
JoshTonksJoshTonks
Just a normal picklist which then updates a number field. It's alright youve linked me to the stuff i need thanks a bunch.