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
salesforce instancesalesforce instance 

I have tried creating a validation rule on case

I have tried creating a validation rule on case with the below condition. When am trying to test, it was working fine but it was throwing an error even when all the required fields are filled and also throws an error message even when trying to close a case. 
AND(
$User.Country ='AB',
ISPICKVAL(Status,"Closed"),
OR(
ISBLANK(Account.Name),
ISBLANK(A),
ISBLANK(B),
ISBLANK(C),
ISBLANK(D),
ISBLANK(E)))

Exact requirement is when status of the case is closed all the fields A,B,C,D,E fields are mandatory to fill through validation rule
SubratSubrat (Salesforce Developers) 
Hello ,

Based on your requirement, it seems that the validation rule is not working as expected. Let's modify the validation rule to ensure that it enforces the required fields to be filled only when the case status is "Closed." We'll also handle the scenario where the user's country is not 'AB.'

Here's the updated validation rule:
AND(
  ISPICKVAL(Status, "Closed"),
  $User.Country = 'AB',
  OR(
    ISBLANK(Account.Name),
    ISBLANK(A__c),
    ISBLANK(B__c),
    ISBLANK(C__c),
    ISBLANK(D__c),
    ISBLANK(E__c)
  )
)
Please note the following changes in the updated validation rule:

Removed $ from the field names (A, B, C, D, E). Field names should be written with __c at the end to represent custom fields.
Added $User.Country = 'AB' to ensure that the rule applies only to users with 'AB' as their country.
With this modification, the validation rule should only trigger when the case status is "Closed" and the required fields (Account.Name, A_c, Bc, Cc, Dc, and E_c) are left blank. It should not trigger for any other scenario.

Hope this helps !
Thank you.
george butler 7george butler 7
It seems like there might be an issue with your validation rule's logic. From the condition you provided, it appears you want to enforce that when the status of a case is "Closed," certain fields (A, B, C, D, E) and the Account Name must be filled out. However, it's possible that the validation rule is being triggered incorrectly.
Here's a possible explanation for the issue you're facing:
The validation rule fires when the status is "Closed," which is as intended.
It then checks if any of the specified fields (Account.Name, A, B, C, D, E) are blank.
If any of these fields are blank, it triggers the error message.
The problem might arise if there's another validation rule or process in place that modifies these fields after your validation rule is checked. For instance, if there's a process or trigger that updates the fields after your validation rule's initial check, the validation rule could be triggered again, leading to an unexpected error.
To troubleshoot and fix this issue, consider the following steps:
Check for Other Processes: Review any other processes, workflow rules, triggers, or automation that might be modifying these fields after your validation rule runs. Make sure they are correctly updating the fields and not causing an unintended trigger of the validation rule.
Error Message: Double-check your error message to ensure it is displaying the correct information. Sometimes, error messages can be misleading if they are not written precisely.
Validation Rule Evaluation: Make sure the validation rule is evaluated as expected. For example, if it's a formula-based validation rule, ensure that the formula criteria are properly structured and correctly referencing fields.
Testing: Perform thorough testing in different scenarios, including updating the fields and changing the case status. Make sure the validation rule behaves consistently and as expected.
Debug Logs: Check the debug logs generated during the testing process to see if they provide any insight into why the validation rule is being triggered unexpectedly.
Salesforce Updates: Salesforce periodically releases updates and bug fixes. It's possible that there might have been changes in the platform that affect the behavior of validation rules. Ensure that your Salesforce instance is up-to-date.
If you've gone through these steps and are still facing the issue, consider reaching out to your Salesforce administrator or support for further assistance. They might be able to provide more specific guidance based on your organization's setup and any recent changes made.
i had the same issue with my tattoo kit (https://tattoovillas.com/wormhole-tattoo-kit-review/) account this things work very well