Skip to main content
deleted 287 characters in body
Source Link
Adrian Larson
  • 151.4k
  • 38
  • 247
  • 431

Here it is the Trigger on Event Activity

trigger eventHistoryChecker on Event (after update) 
{
 
/////////

//This is the Trigger handles record updates from the Event Obj

/////////////

    for (Event evt : Trigger.new)
    {
        //Access the Old Event record by its IDoldevt in= Trigger.OldMap
        Event oldevt=Trigger.oldMap.get(evt.id);
        //Trigger.New records are conveniently the New versions!
      String oldSub String= oldSub=oldevtoldevt.Subject;
        string newSub=evtnewSub = evt.Subject;
        if(newSub.equals(oldSub)) { }
        else evt.addError('Can not change Subject Field');
        
    }
    
}

Here it is the Test Class for this Trigger but i am not sure its correct or not plz help me to resolve the problem

@isTest
public class eventHistoryChecker_TC
{
 
    static testmethod void TestMeth()
    {
        Event e=new Event();
        e.subject='Call';
        e.Ownerid='005900000037wZv';
        e.EndDateTime=System.Today();
        e.StartDateTime=System.Today();
        insert e;
    }
}

Here it is the Trigger on Event Activity

trigger eventHistoryChecker on Event (after update) 
{
 
/////////

//This is the Trigger handles record updates from the Event Obj

/////////////

    for(Event evt:Trigger.new)
    {
        //Access the Old Event record by its ID in Trigger.OldMap
        Event oldevt=Trigger.oldMap.get(evt.id);
        //Trigger.New records are conveniently the New versions!
        String oldSub=oldevt.Subject;
        string newSub=evt.Subject;
        if(newSub.equals(oldSub)){}
        else evt.addError('Can not change Subject Field');
        
    }
    
}

Here it is the Test Class for this Trigger but i am not sure its correct or not plz help me to resolve the problem

@isTest
public class eventHistoryChecker_TC
{
 
    static testmethod void TestMeth()
    {
        Event e=new Event();
        e.subject='Call';
        e.Ownerid='005900000037wZv';
        e.EndDateTime=System.Today();
        e.StartDateTime=System.Today();
        insert e;
    }
}

Here it is the Trigger on Event Activity

trigger eventHistoryChecker on Event (after update) 
{
    for (Event evt : Trigger.new)
    {
        Event oldevt = Trigger.oldMap.get(evt.id);
        String oldSub = oldevt.Subject;
        string newSub = evt.Subject;
        if(newSub.equals(oldSub)) { }
        else evt.addError('Can not change Subject Field');
    }
}

Here it is the Test Class for this Trigger but i am not sure its correct or not plz help me to resolve the problem

@isTest
public class eventHistoryChecker_TC
{
    static testmethod void TestMeth()
    {
        Event e=new Event();
        e.subject='Call';
        e.Ownerid='005900000037wZv';
        e.EndDateTime=System.Today();
        e.StartDateTime=System.Today();
        insert e;
    }
}
edited title
Link
cropredy
  • 73.3k
  • 8
  • 128
  • 284

Problem on Unit Test Class which for Triggertest does not cover lines of after update trigger

formatted
Source Link
highfive
  • 6.3k
  • 3
  • 32
  • 58

Here it is the Trigger on Event Activity

trigger eventHistoryChecker on Event (after update) {

/////////

//This Here it is the Trigger handles record updates from theon Event Obj

/////////////Activity

trigger eventHistoryChecker on Event (after update) 
{

/////////

//This is the Trigger handles record updates from the Event Obj

/////////////

    for(Event evt:Trigger.new)
    {
        //Access the Old Event record by its ID in Trigger.OldMap
        Event oldevt=Trigger.oldMap.get(evt.id);
        //Trigger.New records are conveniently the New versions!
        String oldSub=oldevt.Subject;
        string newSub=evt.Subject;
        if(newSub.equals(oldSub)){}
        else evt.addError('Can not change Subject Field');
        
    }
    
}

}

Here it is the Test Class for this Trigger but i am not sure its correct or not plz help me to resolve the problem

@isTest

public class eventHistoryChecker_TC

{ Here it is the Test Class for this Trigger but i am not sure its correct or not plz help me to resolve the problem

@isTest
public class eventHistoryChecker_TC
{

    static testmethod void TestMeth()
    {
        Event e=new Event();
        e.subject='Call';
        e.Ownerid='005900000037wZv';
        e.EndDateTime=System.Today();
        e.StartDateTime=System.Today();
        insert e;
    }
}

}

Here it is the Trigger on Event Activity

trigger eventHistoryChecker on Event (after update) {

/////////

//This is the Trigger handles record updates from the Event Obj

/////////////

for(Event evt:Trigger.new)
{
    //Access the Old Event record by its ID in Trigger.OldMap
    Event oldevt=Trigger.oldMap.get(evt.id);
    //Trigger.New records are conveniently the New versions!
    String oldSub=oldevt.Subject;
    string newSub=evt.Subject;
    if(newSub.equals(oldSub)){}
    else evt.addError('Can not change Subject Field');
    
}

}

Here it is the Test Class for this Trigger but i am not sure its correct or not plz help me to resolve the problem

@isTest

public class eventHistoryChecker_TC

{

static testmethod void TestMeth()
{
    Event e=new Event();
    e.subject='Call';
    e.Ownerid='005900000037wZv';
    e.EndDateTime=System.Today();
    e.StartDateTime=System.Today();
    insert e;
}

}

Here it is the Trigger on Event Activity

trigger eventHistoryChecker on Event (after update) 
{

/////////

//This is the Trigger handles record updates from the Event Obj

/////////////

    for(Event evt:Trigger.new)
    {
        //Access the Old Event record by its ID in Trigger.OldMap
        Event oldevt=Trigger.oldMap.get(evt.id);
        //Trigger.New records are conveniently the New versions!
        String oldSub=oldevt.Subject;
        string newSub=evt.Subject;
        if(newSub.equals(oldSub)){}
        else evt.addError('Can not change Subject Field');
        
    }
    
}

Here it is the Test Class for this Trigger but i am not sure its correct or not plz help me to resolve the problem

@isTest
public class eventHistoryChecker_TC
{

    static testmethod void TestMeth()
    {
        Event e=new Event();
        e.subject='Call';
        e.Ownerid='005900000037wZv';
        e.EndDateTime=System.Today();
        e.StartDateTime=System.Today();
        insert e;
    }
}
Source Link
Loading