• Jason Thurgood
  • NEWBIE
  • 0 Points
  • Member since 2015
  • Solution Architect
  • Silverline


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
CODE: 

trigger LeadTrigger on Lead (before insert) {

    
    Id recordtypeId = [SELECT Id FROM RecordType WHERE DeveloperName = 'SalesLead' AND SobjectType = 'Lead'].id;

    List<Lead> LeadList = [SELECT Id, Round_Robin_Id__c, RecordTypeId, Eligible_for_Round_Robin__c FROM Lead WHERE RecordTypeId =: recordTypeId AND Eligible_for_Round_Robin__c = TRUE ORDER BY Round_Robin_Id__c DESC LIMIT 1];
    
    for(Lead lead :trigger.new)     
    {  
        IF( Lead.RecordTypeId == recordtypeId && Lead.MobilePhone != null )
        {
            
            IF( LeadList.size() > 0 )
            {
                Decimal maxlead = leadList[0].Round_Robin_ID__c;  
                lead.Round_Robin_ID__c = maxlead +1;  
        
            }
            else
            {
              lead.Round_Robin_ID__c = 1; 
            }
        }
    }
}


ERROR: 

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger LeadTrigger caused an unexpected exception, contact your administrator: LeadTrigger: execution of AfterInsert caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.LeadTrigger: line 17, column 1  (line 17 is bold and italisized) 

I know this is probably super obvious to some of you.  But thanks for any hep. 
Dear All,

I have enabled forecasts in my org. But While I try to access forecast types page its showing "The page you requested was not found, or you do not have permission to view this page."

May I know the reason?User-added image
 
CODE: 

trigger LeadTrigger on Lead (before insert) {

    
    Id recordtypeId = [SELECT Id FROM RecordType WHERE DeveloperName = 'SalesLead' AND SobjectType = 'Lead'].id;

    List<Lead> LeadList = [SELECT Id, Round_Robin_Id__c, RecordTypeId, Eligible_for_Round_Robin__c FROM Lead WHERE RecordTypeId =: recordTypeId AND Eligible_for_Round_Robin__c = TRUE ORDER BY Round_Robin_Id__c DESC LIMIT 1];
    
    for(Lead lead :trigger.new)     
    {  
        IF( Lead.RecordTypeId == recordtypeId && Lead.MobilePhone != null )
        {
            
            IF( LeadList.size() > 0 )
            {
                Decimal maxlead = leadList[0].Round_Robin_ID__c;  
                lead.Round_Robin_ID__c = maxlead +1;  
        
            }
            else
            {
              lead.Round_Robin_ID__c = 1; 
            }
        }
    }
}


ERROR: 

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger LeadTrigger caused an unexpected exception, contact your administrator: LeadTrigger: execution of AfterInsert caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.LeadTrigger: line 17, column 1  (line 17 is bold and italisized) 

I know this is probably super obvious to some of you.  But thanks for any hep. 
Hi there, I 'm trying to complete the "Automating Processes with the Lightning Process Builder" challenge in TrailHead but I get the following error :
Encountered unhandled fault when running process Update_contact_adress/
301240000004FXO exception by user/organization: 00D24000000JsNt/{4}

The flow failed to access the value for myVariable_current.Account.ShippingCountry because it hasn't been set or assigned.
caused by element : FlowRecordUpdate.myRule_1_A1
caused by: The flow failed to access the value for myVariable_current.Account.ShippingCountry because it hasn't been set or assigned.
Salesforce Error ID: 490660201-42718 (736882147)

Any idea what could be could wrong ?