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

Validation Rule Help, not sure where to start.

I have a custom object called Service Engagements, and a related object called Service engagement parts.  I would like to create a validation rule so that when the user is in the service engagements, they are not able to create a Parts Request if the status of the SE is set to 'Ready for Billing'  'Billing Complete'  'Posted'  Complete - No Charge'.


The button for the Parts Request brings them to a visual force page, there is code in the class that is supposed to set this to readonly - true, and then gives a error message.  The problem is that for some strange reason (which I am still looking into) this does not work all the time, it is hit or miss.  I am working with the developer to figure out the issue, it is just taking a while. 


So in the meantime I was going to make a validation rule on the SE Parts request that says if the Service Engagement status is set to 'Ready for Billing'  'Billing Complete'  'Posted'  Complete - No Charge', it won't allow them to save it.  I realize this will be a pain for the user since they have already filled out the info, but they are supposed to check anyhow.


So the Parts Request Object I started a validation rules that looks at the status of the SE.  Service_Engagement__r.Status__c , but I have no idea how to write this (I am very new to this as you can tell).  Any help would be greatly appreciated.  I am guessing I can set this so that they can't save it just with the error message.


Thank you very much for any input.


You can try below validation formula:



OR( Status__c ='Ready for Billing', Status__c = 'Billing Complete' ,Status__c = 'Posted' ,Status__c = 'Complete - No Charge')




OR(ISPICKVAL( Status__c ="Ready for Billing","Billing Complete","Posted","Complete - No Charge"))

You can write a validation rule in Parts Request object.



 ISPICKVAL(Service_Engagement__r.Status__c, 'Ready for Billing'),

 ISPICKVAL(Service_Engagement__r.Status__c, 'Billing Complete'),

 ISPICKVAL(Service_Engagement__r.Status__c,  'Posted'),

 ISPICKVAL(Service_Engagement__r.Status__c,  'Complete - No Charge')



.. and then put an error message.


Does this help? Let me know if not..