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
raghu123raghu123 

systen.DmlException:Insertfailed

Hi Guys,

                I am trying to insert a record into CustomObject   SalesOrderLine__c . getting error

 

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, SalesOrderLineBeforeUpdateInsert: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference.

 

  public pageReference save()
{           
  SalesOrderLine__c sol = new SalesOrderLine__c();      
  sol.SalesOrder__c = salesorder1.Name;  
  sol.Product__c = 'a0X40000000ZwTU' ;   
  sol.OrderQuantity__c  = 3; 
  insert sol;      
  return null;     
}  

   Appreciate your help,

   Thank You 

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
b-Forceb-Force

this code has no issue,

 

Check out is there any trigger is firing  after insert , after update for CustomObject   SalesOrderLine__c

probably this trigger is throwing exception

 

hope this will help you

 

Thanks,

Bala

All Answers

b-Forceb-Force

this code has no issue,

 

Check out is there any trigger is firing  after insert , after update for CustomObject   SalesOrderLine__c

probably this trigger is throwing exception

 

hope this will help you

 

Thanks,

Bala

This was selected as the best answer
raghu123raghu123

Hey Bala,

                   Thanx for your reply.. I downloaded app from appechange. so i cant see that trigger code.

Anyways thanx 4 ur help...:))