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
Dave Wolfe 11Dave Wolfe 11 

Validation rule triggered in error on insert from another object

I have created a validation rule on a field on a custom object that is part of a managed package. The validation rule simply prohibits the text length in the field from exceeding 30 characters. The actual text field the rule is on is a 255 character text field, but for our uses we need to limit the length to 30 characters. Since that field is part of a managed packaged I cannot change the field length. It works perfectly for standard inputs.

The issue arises when a record in the object is created from another custom object in the managed package. We are using Process Builder to populate the field that the validation rule is on with the text from a custom field in the originating object. It worked flawlessly until I created the validation rule. The text field in the originating  object is only 30 characters long so it cannot exceed the rule limits. With the validation rule activated every time the originating object inserts a record the validation rule causes an error and prevents the insertion. And the Validation Rule fires before the Process Builder does so it cannot be the text length in the originating field causing the error.

Any ideas??
Shashikant SharmaShashikant Sharma
Hi Dave, 

Could you share your validation rule formula , i just have doubt that null condition is not checked or something missing in Validation rule causing this.

Thanks
Shashikant
Dave Wolfe 11Dave Wolfe 11
Sure - here is ther rule formula. I should also mention that this field is a required field on the receiving object.

User-added image

 
Shashikant SharmaShashikant Sharma
Could you share a screen shot of validation error message when record is being created for originating object. Please show error message and the Invoice Number on the screen shot.
Dave Wolfe 11Dave Wolfe 11
Here is the error message.....the invoice number does not appear on the same screen as the error message though.

User-added image
Here is a screen shot of the actual invoice number field.

User-added image

Here is a screen shot of the invoice number for this record that caused the error.

User-added image
Shashikant SharmaShashikant Sharma
Please try to put a condition in validation RULE like below so it only checks length for Non Null, Non Blank value only.
AND( NOT(ISNULL(AcctSeed_Payee_Reference__c)), 
          NOT(ISBLANK(AcctSeed_Payee_Reference__c)), 
          LEN( AcctSeed_Payee_Reference__c ) >30 
        )

Let me know the results if it still shows same error or not ?



 
Dave Wolfe 11Dave Wolfe 11
It is still showing the same error.