I am using a screen flow to capture information that will create multiple records, and one of the fields I need to capture is a Phone field. Depending on a value set previously (Country), the phone number needs to have different number of digits. I was hoping I could create a resource that will be the Pattern used to validate the phone number, but have not been able to figure out how to do this.

I've tried to create a formula resource with text output using the following structure


But I keep getting a syntax error.

Does anyone know if it is at all possible to have a pattern that is conditional in this way?

1 Answer 1


You have three errors in your formula expression

  1. Missing comma at end of this line: US,"^\d{10}$"
  2. Missing surrounding quotes around CO and US
  3. The backslashes have to be double-escaped


  • thanks!! I'm super-happy that a) this is possible to do and b) you fixed my formula errors :) Oct 20, 2023 at 9:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .