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
Tal CarmiTal Carmi 

AddError function doesn't cause error in self service portal

Hi,

I've created a trigger that performs a quality check and then uses the AddError function to prevent the user from saving the record and displays the appropriate error.

In the Sandbox it works great, but when using the Self Service Portal it doesn't work. Meaning it lets the user save the record, though if I try to insert a record with the same exact information in the sandbox I get an error message.

Any ideas?

Thanks a lot,

Tal

SurekaSureka

Hi,

 

addError method works in the Self service portal also

 

Can you elaborate more on the issue.

 

Thanks

 

 

Tal CarmiTal Carmi

This is the relevant code. As I said, it prevents cases from being created in the sandbox, but it allows the same cases to be created via the Self Service Portal (that is related to the sandbox, records created in it appear in the sandbox). Any ideas? 

 

for (Case newCase: newCases){
		for (Case matchCase: matchingCases){
			if (matchCase.Account_Vehicle__c!=NULL&&
				newCase.AccountId!=NULL&&newCase.AccountId==matchCase.AccountId&&
			    newCase.Account_Vehicle__c.replace(' ','')==matchCase.Account_Vehicle__c.replace(' ','')){
				newCase.addError('error msg...');
			}
		}
	}