Help

[Formula] use option IDs instead of values for single/multiple select fields

Topic Labels: Formulas
1227 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Ludom_Initiativ
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi everyone,

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)?

Best,
Ludo

2 Replies 2
Ilan_Ben_Yaakov
6 - Interface Innovator
6 - Interface Innovator

you should use the function RECORDID():

IF(RECORDID(Choice)="selQHcj58xhh44C1J","blah","")

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.

IF(Choice="1","blah")

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.