• Luke Bottomley
  • NEWBIE
  • 10 Points
  • Member since 2014

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

Hi All,

I'm encountering the following error when i'm using the End DateTime in  a decision element of a flow.

Encountered unhandled fault when running process
 
The flow failed to access the value for myVariable_current.EndDateTime because it hasn't been set or assigned.
 
caused by element : FlowDecision.myDecision
 
caused by: The flow failed to access the value for myVariable_current.EndDateTime because it hasn't been set or assigned.
 
Salesforce Error ID: 1573427097-36578 (-819940845)

The field EndDate is one that is set by default when an event is created so it should be set on all records.

Does anyone know why i might be running into this error? Is it because the process builder is running as a before trigger so before the record is committed to the database?

Any help would be great! Thanks in advance.

Hi,

I've written some code which will add a lead automatically to a campaign should it meet certain criteria.
Can anyone shed any light on why i'm only acheiving 50% code coverage with the test class? 
The assert passes so the Campaign Members are being created.
I've tried to insert campaign members also but this didn't help either.

Any ideas would be greatly appreciated!

n.b. I know it's bad practice to hard code the Campaign Id and i'll look to write this out at a later date.
 
trigger NewWebRegistrant on Lead (before insert) {

   List <Lead> LeadList = [Select Id,LeadSource FROM Lead WHERE LeadSource = 'New Web Registrant' AND Id IN :Trigger.new];
   List<CampaignMember> NewMembers = new List<CampaignMember>();
    
    	if (LeadList.size() > 0){
                
            for (Lead l: LeadList){
                
		newMembers.add(new CampaignMember(
                LeadId = l.Id,
                CampaignId = '701g000000073cH',
                Status = 'Not Yet Contacted'));   
  
              insert NewMembers;
            	system.debug('Members is list are' + NewMembers);
          }
    }
}
@isTest
public class TestTrigger {
    
    static testMethod void TestTrigger (){
        
        Set<Id> LeadsInserted = new Set <Id> ();
		
 		List<Lead> newLeads = new List <Lead>();
        
            for(Integer x = 0; x < 200; x++){
                Lead l = new Lead();
   		 l.FirstName = 'test';
         l.LastName = 'test' + x;
         l.Email = 'test@test.com';
         l.LeadSource = 'Test';
         l.Lead_Source_Detail_NEW__c ='Test';
               newLeads.add(l);
            }
        
        insert newLeads;
        

         //Test that for all leads are added to the campaign.      
        
         List<CampaignMember> Members= [Select Id,LeadId,CampaignId FROM CampaignMember WHERE CampaignId = '701g000000073cH'];
                for (CampaignMember cm : Members){
                    Boolean contains = (LeadsInserted).contains(cm.LeadId);
						System.assertEquals(contains, True);
                	}
               }
	}


 

Hi All,

I'm encountering the following error when i'm using the End DateTime in  a decision element of a flow.

Encountered unhandled fault when running process
 
The flow failed to access the value for myVariable_current.EndDateTime because it hasn't been set or assigned.
 
caused by element : FlowDecision.myDecision
 
caused by: The flow failed to access the value for myVariable_current.EndDateTime because it hasn't been set or assigned.
 
Salesforce Error ID: 1573427097-36578 (-819940845)

The field EndDate is one that is set by default when an event is created so it should be set on all records.

Does anyone know why i might be running into this error? Is it because the process builder is running as a before trigger so before the record is committed to the database?

Any help would be great! Thanks in advance.

Hi,

I've written some code which will add a lead automatically to a campaign should it meet certain criteria.
Can anyone shed any light on why i'm only acheiving 50% code coverage with the test class? 
The assert passes so the Campaign Members are being created.
I've tried to insert campaign members also but this didn't help either.

Any ideas would be greatly appreciated!

n.b. I know it's bad practice to hard code the Campaign Id and i'll look to write this out at a later date.
 
trigger NewWebRegistrant on Lead (before insert) {

   List <Lead> LeadList = [Select Id,LeadSource FROM Lead WHERE LeadSource = 'New Web Registrant' AND Id IN :Trigger.new];
   List<CampaignMember> NewMembers = new List<CampaignMember>();
    
    	if (LeadList.size() > 0){
                
            for (Lead l: LeadList){
                
		newMembers.add(new CampaignMember(
                LeadId = l.Id,
                CampaignId = '701g000000073cH',
                Status = 'Not Yet Contacted'));   
  
              insert NewMembers;
            	system.debug('Members is list are' + NewMembers);
          }
    }
}
@isTest
public class TestTrigger {
    
    static testMethod void TestTrigger (){
        
        Set<Id> LeadsInserted = new Set <Id> ();
		
 		List<Lead> newLeads = new List <Lead>();
        
            for(Integer x = 0; x < 200; x++){
                Lead l = new Lead();
   		 l.FirstName = 'test';
         l.LastName = 'test' + x;
         l.Email = 'test@test.com';
         l.LeadSource = 'Test';
         l.Lead_Source_Detail_NEW__c ='Test';
               newLeads.add(l);
            }
        
        insert newLeads;
        

         //Test that for all leads are added to the campaign.      
        
         List<CampaignMember> Members= [Select Id,LeadId,CampaignId FROM CampaignMember WHERE CampaignId = '701g000000073cH'];
                for (CampaignMember cm : Members){
                    Boolean contains = (LeadsInserted).contains(cm.LeadId);
						System.assertEquals(contains, True);
                	}
               }
	}