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
Haseeb Ahmad 9Haseeb Ahmad 9 

Help with validation rule on project object


Hello everyone,

I have this validation rule which stops users to put the project on hold and presents them the error if their profile is not Admin or billing. which works great. 

This is the formula. 

if(
(Date_of_Hold__c < LatestHold__c &&
(ISPICKVAL(accorto__Status__c, 'On Hold') ||
Date_of_Hold__c < LatestHold__c &&
ISPICKVAL(accorto__Progress__c, 'On Hold'))),

if(
$Profile.Name == 'System Administrator' ||
$Profile.Name == 'Zuora Billing Team',
false,
true),
false)

The problem is now those users not able to update project which is already on hold. 

what I really want is to make sure, 1st, they cannot put the project on hold, 2nd,  if the project is already on hold they should be able to make changes to all other fields except the status field.

which is currently not happening and they getting an error that the project is on hold even making changes to other fields.

Any idea how can I able to modify this validation rule? thank you. 
ayu sharma devayu sharma dev
Hello,

You can try checking if the changed field is status or not:
 
if(
    AND( ISChanged( accorto__Status__c ),
        (Date_of_Hold__c < LatestHold__c &&
        (ISPICKVAL(accorto__Status__c, 'On Hold') ||
        Date_of_Hold__c < LatestHold__c &&
        ISPICKVAL(accorto__Progress__c, 'On Hold')))
     ),

if(
$Profile.Name == 'System Administrator' ||
$Profile.Name == 'Zuora Billing Team',
false,
true),
false)

Let me know if it helps,

Thanks,
Ayush Sharma