I have a business rule in ProjectTypeComplianceBridge object that checks for duplicate records, and displays an error if enter a record that would be a duplicate in this object.
ProjectTypeComplianceBridge is a bridge object (intersection) table that resloves the many to many relationship between ProjectType and ComplianceStandard. Think of Loans as the many to many bridge between items and members in the library application.
The business rule on ProjectTypeComplianceBridge is:
If EXISTS ProjectTypeComplianceBridge WHERE (ProjectTypeComplianceBridge.ComplianceStandard=ThisProjectTypeComplianceBridge.ComplianceStandard AND ProjectTypeComplianceBridge.ProjectType=ThisProjectTypeComplianceBridge.ProjectType) Then
REPORT ERROR 'A record already exists for Compliance Standard: '+ThisProjectTypeComplianceBridge.ComplianceStandard.Name+' and Project Type: '+ThisProjectTypeComplianceBridge.ProjectType.Name
This is executing (returning the error message) even when there are no existing records in ProjectTypeComplianceBridge.
Use case:
Entered a new ProjectTypeComplianceBridge record (without the business rule enabled). Worked.
Removed the record. Worked.
Entered a new ProjectTypeComplianceBridge record (without the business rule enabled). Worked.
Removed the record. Worked.
So the system works fine without the business rule.
Locked, added the business rule, and set to test mode.
Tried to enter a new ProjectTypeComplianceBridge record. Got the duplicates business rule error message (bad).
Searched objects for ProjectTypeComplianceBridge. No data found - good.
So, seems this business rule is somehow seeing the new record as the existing record, and it is retuning true.
The code for the business rule seems pretty straightforward.
Dave