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
Arav SundarArav Sundar 

VAlidation rules on Number & Pecent Datatype

Hi All , 

i am having an 2 fields booked value (number data type) and Booked value percentage (Percentage data type) below is my validation 
"SBLANK (Booked_value__c ) && number_fields__c <= 100" i tried with many its not working bascialy my requeitement is when user is trying to create a record it should enforce the record to enter the data for that i am using isblank for the booked value field then in the booked value percentage field the number should be 0 to 100% can anyone let me know where is it going wrong 
Tejas KardileTejas Kardile
Hi,

Please try below forumula in validation rule, this will trigger only in record creation.

IF( ( ISNEW()&& ISBLANK( Booked_value__c ) &&  number_fields__c  >=100) , true, false)

Thanks
SFDC RJSFDC RJ
HI,
use this formula to restrict user to enter value in number field and enter value from 0 to 100 in percentage field
OR( 
ISBLANK( number_field__c ) , 
OR( 
percent_field__c> 1.0, 
percent_field__c< 0.0 

)

Please mark this question as Solved if this helps you so that others can view it as a proper solution.

Thanks,
Rahul 
Arav SundarArav Sundar
Thanks for the reply Tejas but as you have used the ISNEW this is will happen at the time of record creation but percentage should be able to edit and save even after the record creation 
SFDC RJSFDC RJ
@arav 
Try my validation it is working according to your requirment.
Thnaks
Arav SundarArav Sundar
No its not working 
SFDC RJSFDC RJ
Your requirmnt is this ,
You want number field to be required and percentage field to be between 1 -100. ? 
In any of the case you want error message?
 
Arav SundarArav Sundar
i want both the fields to enter the data with the condition but as OR is used its satisifing the any one condituon
SFDC RJSFDC RJ
No if you use OR then either number field is null or percentage field is more than 100 in both case it will show error.
You will have to satisfy both condition to enter record to database.
Thanks
 
Tejas KardileTejas Kardile
Hi,

Please try below solution:
IF( (  ISBLANK( Booked_value__c ) &&  number_fields__c  >=1.00) , true, false)
Tejas KardileTejas Kardile
@Arav - Let me know if above solution is working for you.
Akhil AnilAkhil Anil
Hi Arav,

Give this a shot. It should definitely work.
 
OR(
ISBLANK(Booked_value__c),
OR( 
OR( 
number_fields__c < 0, 
number_fields__c > 1.0 
), 
ISBLANK(number_fields__c) 
)
)