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
Sanjana RajasekarSanjana Rajasekar 

Formula in Screen Flow

Hi,
I have created a screen flow with picklist field "Schedule Frequency" 
and a number field "Schedule Count"
The Picklist has options : Weekly, Monthy , Yearly , One-Time
When the user select One-Time , Schedule count should be always one.
How could I validate the Schedule Count field? 
User-added image
Best Answer chosen by Sanjana Rajasekar
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Sanjana,

Can you try as below.
 
if({!Scheduled_field}='One-Time',  if({!scheduleCount}!=1,false,true),true)

Thanks,
 

All Answers

Sai PraveenSai Praveen (Salesforce Developers) 
Hi,

Can you try the formula as below on schedule count in screen.

Replace Scheduled_field with the field name of first field and {!onetime} is the choice not the value. You have to give choice.

scheduleCount is the second field name .
if({!Scheduled_field}={!onetime},  if({!scheduleCount}!=1,false,true),true)
Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Thanks,
 
Sanjana RajasekarSanjana Rajasekar
Hi @Sai Praveen
Can we validate without creating the choice set. As the Schedule Frequency is a picklist choice set. 
Thanks
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Sanjana,

Can you try as below.
 
if({!Scheduled_field}='One-Time',  if({!scheduleCount}!=1,false,true),true)

Thanks,
 
This was selected as the best answer
Tom Roger 1Tom Roger 1
This is chatgpt generated answer to your question, if it solves your problem then this is well and good. 
You can validate the Schedule Count field by using a validation rule. Here are the steps to create a validation rule:
Go to the Object Manager and select the object that you want to create the validation rule.
Click on the "Validation Rules" section and click on the "New" button.
Enter a name for the validation rule and a description (optional).
In the "Rule Criteria" section, enter the following formula:
AND( ISPICKVAL(Schedule_Frequency__c, "One-Time"), Schedule_Count__c <> 1 )
Replace "Schedule_Frequency__c" with the API name of the picklist field and "Schedule_Count__c" with the API name of the number field.
Click on the "Save" button.
This validation rule checks if the Schedule Frequency picklist value is "One-Time" and if the Schedule Count value is not equal to one. If this condition is met, an error message will be displayed when the user tries to save the record. 🤩 (https://balloonslane.com/nj-balloons/)