• Mark Keckeis 34
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies

Hi All. I am positive I am missing something simple. I would like to throw an error on a standard page - at the top of the page - when a boolean has been set on the record. This effectively locks the reord from being adited any further. Code follows:

You can see the error I would like to throw. Problem is that the error thrown looks like this:

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger SalesorderTrigger caused an unexpected exception, contact your administrator: SalesorderTrigger: execution of BeforeUpdate caused by: System.FinalException: SObject row does not allow errors: Class.SOTriggerHelper.validateSOCanBeSubmitted: line 10, column 1

 

What am I missing?

public class myException extends Exception {}
    
	public static void validateSOCanBeSubmitted(List<Netsuite_Sales_Order__c> newTrigger, List<Netsuite_Sales_Order__c> oldTrigger, Map<Id, Netsuite_Sales_Order__c> oldMap){
													
		for(Netsuite_Sales_Order__c so :oldTrigger){
			if(so.Netsuite_SO_Entered__c == true){

					so.addError( new myException('This SO has been locked because it has already been submitted'));
					
				}
		}	

Hi All. I am positive I am missing something simple. I would like to throw an error on a standard page - at the top of the page - when a boolean has been set on the record. This effectively locks the reord from being adited any further. Code follows:

You can see the error I would like to throw. Problem is that the error thrown looks like this:

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger SalesorderTrigger caused an unexpected exception, contact your administrator: SalesorderTrigger: execution of BeforeUpdate caused by: System.FinalException: SObject row does not allow errors: Class.SOTriggerHelper.validateSOCanBeSubmitted: line 10, column 1

 

What am I missing?

public class myException extends Exception {}
    
	public static void validateSOCanBeSubmitted(List<Netsuite_Sales_Order__c> newTrigger, List<Netsuite_Sales_Order__c> oldTrigger, Map<Id, Netsuite_Sales_Order__c> oldMap){
													
		for(Netsuite_Sales_Order__c so :oldTrigger){
			if(so.Netsuite_SO_Entered__c == true){

					so.addError( new myException('This SO has been locked because it has already been submitted'));
					
				}
		}	

Hi All,

 

I need to call two functions and want a delay of 10 seconds between then.

 

It is possible with Apex code ?

 

Thanks,

Deepak