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
Allister McKenzie 10Allister McKenzie 10 

Workflow rule Error: Function REGEX may not be used in this type of formula

I am using the REGEX function in a workflow rule, but I keep getting an error

Error: Function REGEX may not be used in this type of formula

I checked https://help.salesforce.com/htviewhelpdoc?id=customize_functions_i_z.htm&siteLang=en_US#REGEX (https://help.salesforce.com/htviewhelpdoc?id=customize_functions_i_z.htm&siteLang=en_US#REGEX) and it says that REGEX is available everywhere except formula fields and custom buttons.

Can anyone tell me why this is not working? 
 
RecordType.DeveloperName = 'IT Case' && REGEX(Description, '[A-Z]{3}[0-9]{1}')


 
Best Answer chosen by Allister McKenzie 10
Neetu_BansalNeetu_Bansal
Hi Allister,

For using REGEX, you need to select Evaluation criteria as 'created, and every time it’s edited', REGEX is not allowed to be used in this type of functions. Please see the screenshot at below:
User-added image

If you need any other workflow criteria, then either change the formula or you can do the same in apex triggers. Let me know, if you need any other help.

Thanks,
Neetu

All Answers

Neetu_BansalNeetu_Bansal
Hi Allister,

For using REGEX, you need to select Evaluation criteria as 'created, and every time it’s edited', REGEX is not allowed to be used in this type of functions. Please see the screenshot at below:
User-added image

If you need any other workflow criteria, then either change the formula or you can do the same in apex triggers. Let me know, if you need any other help.

Thanks,
Neetu
This was selected as the best answer
Allister McKenzie 10Allister McKenzie 10
This worked.  Thanks Neetu.
Rajat Bansal 35Rajat Bansal 35
Hi Neetu_Bansal, How can we achive this on formula field?