• kev388
  • NEWBIE
  • 10 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
Hi Everyone,

I am stuck on a trigger. I want this to populate the Inside Sales Representative on the record being saved.  However I am getting an error:

Review all error messages below to correct your data.
Apex trigger OpportunityISR caused an unexpected exception, contact your administrator: OpportunityISR: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.OpportunityISR: line 5, column 1


Here is the Trigger Code:

trigger OpportunityISR on Opportunity (before insert){
    Opportunity oppty;
Set<Id> OpptyId= new Set<Id>();
    
    if(oppty.Inside_Sales_Representative__c == null) {
      oppty.Inside_Sales_Representative__c = Userinfo.getUserId();
      System.debug('Setting Sales Representative to ' + Userinfo.getUserId());       
    } else {
      if(Trigger.isInsert) {
        oppty.Inside_Sales_Representative__c = Userinfo.getUserId();
        System.debug('Setting Opportunity Owner to ' + Userinfo.getUserId());       
      }
}
                     }

Hi Everyone,

 

I am trying to create a Visual Force Page for an approval email and one that displays the opportunity lines items on the approval page layout

 

I am completely new to the Development side of salesforce.com

 

Can someone help me with the code and understanding what is needed?

 

Thanks

 

Kevin

Hi Everyone,

I am stuck on a trigger. I want this to populate the Inside Sales Representative on the record being saved.  However I am getting an error:

Review all error messages below to correct your data.
Apex trigger OpportunityISR caused an unexpected exception, contact your administrator: OpportunityISR: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.OpportunityISR: line 5, column 1


Here is the Trigger Code:

trigger OpportunityISR on Opportunity (before insert){
    Opportunity oppty;
Set<Id> OpptyId= new Set<Id>();
    
    if(oppty.Inside_Sales_Representative__c == null) {
      oppty.Inside_Sales_Representative__c = Userinfo.getUserId();
      System.debug('Setting Sales Representative to ' + Userinfo.getUserId());       
    } else {
      if(Trigger.isInsert) {
        oppty.Inside_Sales_Representative__c = Userinfo.getUserId();
        System.debug('Setting Opportunity Owner to ' + Userinfo.getUserId());       
      }
}
                     }