• Supriya Bethala 1
  • NEWBIE
  • 0 Points
  • Member since 2019

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

I am using service console App.I have a Detail-record page, where you can see (record page, activity timeline page and related list) and on header of the page there is new support case button to create a new case record.
I have an activity timeline (lightning component) that display a case record, event, record view details. Whenever detail page is opened, it automatically retrieve the record ID of that detail page and display those records(CASE,EVENT,RECORD VIEWS DETAILS) in activity Timeline component.
so far whenever we create a case record, I have to manually refresh the page then it will display the new case record in activity timeline page.
Now my requirement is, Instead of doing manual refresh, I want it to auto refresh the activity timeline(lightning component) to view the case record by using NEW SUPPORT CASE button.
ActivityTimeline is a lightning component, where I need to write a code for auto refresh process.
Please let me know if you need more information
Please help me out of this.
Many thanks in advance
 
I have tried to write test class below apex class, its below in that code i can acheive 100% apex test coverage, but in  test class
// i need to bring the case created name here to match the actual values. but getting null values.
- System.assertEquals(applicantId, testFilteredObjects[0].actor); this line i am getting expected values as null- thats why my test class failed, please help me sort out of this,

Please let me  know if you need further information.

Apex class - TimelineCase
 public class TimelineCase extends TimelineObject implements HisTimelineObject{
    public List<TimelineObject> processTimelineItem(id recordId, Integer pageNo, Integer pageSize){
        List<TimelineObject> wrappedCase = new List<TimelineObject>();
        
        List<Case> t = [SELECT Id, Subject, AccountId, CreatedDate, CreatedBy.Name
                        FROM   Case
                        WHERE  Applicant__c = :recordId 
                        LIMIT :pageSize
                        OFFSET :pageNo];
        
        
        if(t != null){
            for(Integer i = 0, CaseSize = t.size(); i < CaseSize; i++){ 
                wrappedCase.add(new TimelineObject().setActor(t[i].CreatedBy.Name)
                                                           .setHeader(t[i].Subject)
                                                           .setDate(t[i].CreatedDate.format())
                                                           .setIconName('standard:case')
                                                           .setIconColour('put the colour in here'));
                
            }
        }

        return wrappedCase;
    }
    
}

Test class

@isTest
public class TimelineCaseTest {
    @isTest 
    public static void itShouldBeAbleToGetApplicantCaseListTest1(){
        String applicantId = new TimelineControllerBuilder().save();
        
      Case caseApplicant = new CaseBuilder().withApplicant(applicantId)
                                                .save();
        TimelineCase historyTimelineCase = new TimelineCase();

               
        Test.startTest();
        List<TimelineObject> testFilteredObjects = historyTimelineCase.processTimelineItem(applicantId, 1, 10);
        
        Test.stopTest();
        System.debug('Case result' + caseApplicant.CreatedBy.Name + testFilteredObjects[0].actor);
        System.assertEquals(1, testFilteredObjects.size());
        //Expected values showing null, actual values get correct
        System.assertEquals(applicantId, testFilteredObjects[0].actor);
               
        System.assertEquals(, testFilteredObjects[0].itemDate);
        System.assertEquals('standard:case', testFilteredObjects[0].iconName);
        System.assertEquals('put the colour in here', testFilteredObjects[0].iconColour);
            
    }

}
I have tried to write test class below apex class, its below in that code i can acheive 100% apex test coverage, but in  test class
// i need to bring the case created name here to match the actual values. but getting null values.
- System.assertEquals(applicantId, testFilteredObjects[0].actor); this line i am getting expected values as null- thats why my test class failed, please help me sort out of this,

Please let me  know if you need further information.

Apex class - TimelineCase
 public class TimelineCase extends TimelineObject implements HisTimelineObject{
    public List<TimelineObject> processTimelineItem(id recordId, Integer pageNo, Integer pageSize){
        List<TimelineObject> wrappedCase = new List<TimelineObject>();
        
        List<Case> t = [SELECT Id, Subject, AccountId, CreatedDate, CreatedBy.Name
                        FROM   Case
                        WHERE  Applicant__c = :recordId 
                        LIMIT :pageSize
                        OFFSET :pageNo];
        
        
        if(t != null){
            for(Integer i = 0, CaseSize = t.size(); i < CaseSize; i++){ 
                wrappedCase.add(new TimelineObject().setActor(t[i].CreatedBy.Name)
                                                           .setHeader(t[i].Subject)
                                                           .setDate(t[i].CreatedDate.format())
                                                           .setIconName('standard:case')
                                                           .setIconColour('put the colour in here'));
                
            }
        }

        return wrappedCase;
    }
    
}

Test class

@isTest
public class TimelineCaseTest {
    @isTest 
    public static void itShouldBeAbleToGetApplicantCaseListTest1(){
        String applicantId = new TimelineControllerBuilder().save();
        
      Case caseApplicant = new CaseBuilder().withApplicant(applicantId)
                                                .save();
        TimelineCase historyTimelineCase = new TimelineCase();

               
        Test.startTest();
        List<TimelineObject> testFilteredObjects = historyTimelineCase.processTimelineItem(applicantId, 1, 10);
        
        Test.stopTest();
        System.debug('Case result' + caseApplicant.CreatedBy.Name + testFilteredObjects[0].actor);
        System.assertEquals(1, testFilteredObjects.size());
        //Expected values showing null, actual values get correct
        System.assertEquals(applicantId, testFilteredObjects[0].actor);
               
        System.assertEquals(, testFilteredObjects[0].itemDate);
        System.assertEquals('standard:case', testFilteredObjects[0].iconName);
        System.assertEquals('put the colour in here', testFilteredObjects[0].iconColour);
            
    }

}
Hi Guys,

I'm trying to build a lightning component which will be used on Opportunity lightning UI. The component is placed in the right panel. The component loads pretty well on any Opportunity record view.

The problem here is when I try to update the opportunity record (which comes as popup block) the component in the right panel is not getting refreshed. By this the updated values are not showing up on the lightint component.

Need to find a way to refresh the lightning component on record save.

Any help would be appreciated!! 

Thanks
Shravan