• Rodolfo Rito
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 8
    Replies
trigger TasksonLeads on Lead (after update) {

    for (Lead l : Trigger.new) {  
        
        if (l.status == 'Awaiting First Call Attempt' 
        && l.aux_reporting_min_req_mql_tasks__c == false
        && l.aux_reporting_first_assigned__c == true
        && l.aux_scoring_first_attempt__c == false
        && l.min_req_mql_landlord__c == null)
    
            {
        
                Task Landlord = new Task();
            
                    String userId = UserInfo.getUserId();
        
                    Landlord.Subject = '1. Is it a landlord?';
                    Landlord.Priority = 'Normal';
                    Landlord.Status = 'Open';
                    Landlord.OwnerId = userId;
                    Landlord.WhatId = l.Id;
                   
                insert Landlord;
                
             }
        
        }
        
}

How can I put the Task in the correct Lead ?

It's giving me this error :

User-added image

Thanks!
trigger TasksonLeads on Lead (after update) {

    for (Lead l : Trigger.new) {  
        
        if (l.status == 'Awaiting First Call Attempt' 
        && l.aux_reporting_min_req_mql_tasks__c == false
        && l.aux_reporting_first_assigned__c == true
        && l.aux_scoring_first_attempt__c == false
        && l.min_req_mql_landlord__c == null)
    
            {
        
                Task Landlord = new Task();
            
                    String userId = UserInfo.getUserId();
        
                    Landlord.Subject = '1. Is it a landlord?';
                    Landlord.Priority = 'Normal';
                    Landlord.Status = 'Open';
                    Landlord.OwnerId = userId;
                    Landlord.WhatId = l.Id;
                   
                insert Landlord;
                
             }
        
        }
        
}

How can I put the Task in the correct Lead ?

It's giving me this error :

User-added image

Thanks!