I can’t find anything about this in the documentation or in the Community posts: is it possible, in a formula, to refer to field option IDs instead of option values?
Let’s take a basic single select field named “Choice” with 2 values: “1” and “0”. It’s likely that these values could be changed to “Yes” and “No” or “Acknowledge” and “Refuse” in the future.
To avoid any issue with the formula when that happens, I’d like to refer to the option IDs matching the value “1” (something like “selQHcj58xhh44C1J”) instead of the values:
instead of IF(Choice="1","blah","") I’d have liked to use IF(Choice="selQHcj58xhh44C1J","blah","") - but it’s not working.
Any way this would be possible in a formula (not in a script)?
No, that’s not possible. Those selection option IDs are only visible to scripts. Formulas that query a single-select field are given a string that represents the field contents, and there’s no way to override that.
As a side note, you can omit the third argument in an IF() function if you want to leave the field blank when the condition isn’t met.
It’s actually preferable to do that in cases when the value returned by the second argument isn’t going to be a string because that final empty string force-converts the other value into a string.
The correct function name is RECORD_ID(), and it only returns the ID of the record. It can’t retrieve the internal selection ID of a single-select option.