• Andrew Russo
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 7
    Replies
Hi,

I am using a pakcage that has a lwc that is used on the record page of cases. There is a flow on the same page that is used to assign perms for that lwc. Once the flow runs i am able to trigger the console tab to refresh that does cuase the fields and related lists to update however the lwc does not reload. The lwc is a managed package. is it possible for me to create a lwc and embed the existing managed one in it? This way i could add some kind of code in the new one that will trigger the lwc to reload when the conbsole tab is refreshed.

Any thoughts or ideas would be greatly appeciated. 
Can someone help me try to find the issue in this code? i am getting this error: "Unable to find action 'init' on the controller of c:CaseCommentsRelatedList"

cmp
<aura:component controller="CommunityCaseDisplayController" implements="force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" >
    <aura:attribute name="commentsdata" type="Object"/>
    <aura:attribute name="RLcolumns" type="List"/>
    <aura:handler name="init" value="{! this }" action="{! c.init }"/>
    
    <lightning:card title="Case Comments" iconName="standard:custom">
        <aura:set attribute="actions">
            <lightning:button label="New" onclick="{!c.displayAddComment}"/>
        </aura:set>
        <p class="slds-p-horizontal_small">     
        <lightning:datatable data="{! v.commentsdata }" 
            columns="{! v.RLcolumns }" 
            keyField="Id"
            hideCheckboxColumn="true"
            minColumnWidth="200"
            maxColumnWidth="1000"/>
        </p>
    </lightning:card>
    <!-- display popup -->
    <div>
        <c:CreateCaseCommentComponent aura:id="displayPopup"  recordId="{!v.recordId}" HideMe="{!c.hidePopup}" />
    </div>    
</aura:component>
apxc
/*
* @Description: APEX Server Side Controller.
* Provides methods to fetch case and work with case from Community
*/
public class CommunityCaseDisplayController { 
    
    @AuraEnabled
    public static List<CaseComment> getCaseComments(String caseId) {
        List<CaseComment> caseComments = 
                [SELECT Id, ParentId, IsPublished, CommentBody,    CreatedDate, CreatedBy.Name, LastModifiedDate, LastModifiedById FROM CaseComment where parentId=:caseId order by CreatedDate desc];
return caseComments;        
    }
    
    @AuraEnabled
    public static CaseComment addCaseComment(String caseId, String commentBody) {
        CaseComment caseComment = new CaseComment(ParentId=caseId, CommentBody=commentBody);
        insert caseComment;
return caseComment;        
    }    
}
js
 
//CaseCommentsRelatedListController.js
({
   init: function (cmp, event, helper) {
        cmp.set('v.RLcolumns', [
            {label: 'Comment', fieldName: 'CommentBody', type: 'text'},
            {label: 'Created Date', fieldName: 'CreatedDate', type: 'date',
             typeAttributes: {year:'numeric', month:'numeric', day:'numeric', hour:'2-digit', minute:'2-digit'}, initialWidth:'200'},
            {label: 'Created By', fieldName: 'createByName', type: 'text', initialWidth:'200'}
        ]);
        helper.getData(cmp);
    },
    
   displayAddComment: function (cmp, event, helper) { 
       var displayPopup = cmp.find("displayPopup");
       var backGroundSectionId = displayPopup.find("backGroundSectionId"); 
       
       $A.util.addClass(displayPopup, "slds-fade-in-open");
       $A.util.removeClass(displayPopup, "slds-fade-in-hide");
       
       $A.util.addClass(backGroundSectionId, "slds-backdrop--open");
       $A.util.removeClass(backGroundSectionId, "slds-backdrop--close");
   },
    
   hidePopup: function(component,event){
       var displayPopup = component.find("displayPopup");
       var backGroundSectionId = displayPopup.find("backGroundSectionId");
       
       $A.util.removeClass(displayPopup, "slds-fade-in-open");
       $A.util.addClass(displayPopup, "slds-fade-in-hide");
       
       $A.util.removeClass(backGroundSectionId, "slds-backdrop--open");
       $A.util.addClass(backGroundSectionId, "slds-backdrop--close");       
    }    
})

https://github.com/kamatvs/Custom-Case-Comment-Component/

 
I am trying to implement a case comment component for communities that was posted in this blog. when I deploy without any text class I get 71% code coverage. what would a test class for this apex class look like? I am just getting into the dev side and I am looking for some help. thank you in advance. 
https://medium.com/@kamatvs/test-66e060ccb91f
/*
* @Description: APEX Server Side Controller.
* Provides methods to fetch case and work with case from Community
*/
public class CommunityCaseDisplayController { 
    
    @AuraEnabled
    public static List<CaseComment> getCaseComments(String caseId) {
        List<CaseComment> caseComments = 
                [SELECT Id, ParentId, IsPublished, CommentBody,    CreatedDate, CreatedBy.Name, LastModifiedDate, LastModifiedById FROM CaseComment where parentId=:caseId order by CreatedDate desc];
return caseComments;        
    }
    
    @AuraEnabled
    public static CaseComment addCaseComment(String caseId, String commentBody) {
        CaseComment caseComment = new CaseComment(ParentId=caseId, CommentBody=commentBody);
        insert caseComment;
return caseComment;        
    }    
}

 
I need to change a custom "My Domain" for a production environment. The normal Salesforce customer service stated I needed to post this question on the developer forum...
Hi,

I am using a pakcage that has a lwc that is used on the record page of cases. There is a flow on the same page that is used to assign perms for that lwc. Once the flow runs i am able to trigger the console tab to refresh that does cuase the fields and related lists to update however the lwc does not reload. The lwc is a managed package. is it possible for me to create a lwc and embed the existing managed one in it? This way i could add some kind of code in the new one that will trigger the lwc to reload when the conbsole tab is refreshed.

Any thoughts or ideas would be greatly appeciated. 
Can someone help me try to find the issue in this code? i am getting this error: "Unable to find action 'init' on the controller of c:CaseCommentsRelatedList"

cmp
<aura:component controller="CommunityCaseDisplayController" implements="force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" >
    <aura:attribute name="commentsdata" type="Object"/>
    <aura:attribute name="RLcolumns" type="List"/>
    <aura:handler name="init" value="{! this }" action="{! c.init }"/>
    
    <lightning:card title="Case Comments" iconName="standard:custom">
        <aura:set attribute="actions">
            <lightning:button label="New" onclick="{!c.displayAddComment}"/>
        </aura:set>
        <p class="slds-p-horizontal_small">     
        <lightning:datatable data="{! v.commentsdata }" 
            columns="{! v.RLcolumns }" 
            keyField="Id"
            hideCheckboxColumn="true"
            minColumnWidth="200"
            maxColumnWidth="1000"/>
        </p>
    </lightning:card>
    <!-- display popup -->
    <div>
        <c:CreateCaseCommentComponent aura:id="displayPopup"  recordId="{!v.recordId}" HideMe="{!c.hidePopup}" />
    </div>    
</aura:component>
apxc
/*
* @Description: APEX Server Side Controller.
* Provides methods to fetch case and work with case from Community
*/
public class CommunityCaseDisplayController { 
    
    @AuraEnabled
    public static List<CaseComment> getCaseComments(String caseId) {
        List<CaseComment> caseComments = 
                [SELECT Id, ParentId, IsPublished, CommentBody,    CreatedDate, CreatedBy.Name, LastModifiedDate, LastModifiedById FROM CaseComment where parentId=:caseId order by CreatedDate desc];
return caseComments;        
    }
    
    @AuraEnabled
    public static CaseComment addCaseComment(String caseId, String commentBody) {
        CaseComment caseComment = new CaseComment(ParentId=caseId, CommentBody=commentBody);
        insert caseComment;
return caseComment;        
    }    
}
js
 
//CaseCommentsRelatedListController.js
({
   init: function (cmp, event, helper) {
        cmp.set('v.RLcolumns', [
            {label: 'Comment', fieldName: 'CommentBody', type: 'text'},
            {label: 'Created Date', fieldName: 'CreatedDate', type: 'date',
             typeAttributes: {year:'numeric', month:'numeric', day:'numeric', hour:'2-digit', minute:'2-digit'}, initialWidth:'200'},
            {label: 'Created By', fieldName: 'createByName', type: 'text', initialWidth:'200'}
        ]);
        helper.getData(cmp);
    },
    
   displayAddComment: function (cmp, event, helper) { 
       var displayPopup = cmp.find("displayPopup");
       var backGroundSectionId = displayPopup.find("backGroundSectionId"); 
       
       $A.util.addClass(displayPopup, "slds-fade-in-open");
       $A.util.removeClass(displayPopup, "slds-fade-in-hide");
       
       $A.util.addClass(backGroundSectionId, "slds-backdrop--open");
       $A.util.removeClass(backGroundSectionId, "slds-backdrop--close");
   },
    
   hidePopup: function(component,event){
       var displayPopup = component.find("displayPopup");
       var backGroundSectionId = displayPopup.find("backGroundSectionId");
       
       $A.util.removeClass(displayPopup, "slds-fade-in-open");
       $A.util.addClass(displayPopup, "slds-fade-in-hide");
       
       $A.util.removeClass(backGroundSectionId, "slds-backdrop--open");
       $A.util.addClass(backGroundSectionId, "slds-backdrop--close");       
    }    
})

https://github.com/kamatvs/Custom-Case-Comment-Component/

 
I am trying to implement a case comment component for communities that was posted in this blog. when I deploy without any text class I get 71% code coverage. what would a test class for this apex class look like? I am just getting into the dev side and I am looking for some help. thank you in advance. 
https://medium.com/@kamatvs/test-66e060ccb91f
/*
* @Description: APEX Server Side Controller.
* Provides methods to fetch case and work with case from Community
*/
public class CommunityCaseDisplayController { 
    
    @AuraEnabled
    public static List<CaseComment> getCaseComments(String caseId) {
        List<CaseComment> caseComments = 
                [SELECT Id, ParentId, IsPublished, CommentBody,    CreatedDate, CreatedBy.Name, LastModifiedDate, LastModifiedById FROM CaseComment where parentId=:caseId order by CreatedDate desc];
return caseComments;        
    }
    
    @AuraEnabled
    public static CaseComment addCaseComment(String caseId, String commentBody) {
        CaseComment caseComment = new CaseComment(ParentId=caseId, CommentBody=commentBody);
        insert caseComment;
return caseComment;        
    }    
}

 
I am going after the Lightning Experience roll-out specialist badge and I am having issues with challenge #10. Could you give me some pointers on how to finish this challenge?  

Here is my error : The Lightning component named TrailheaDX must open a link to https://developer.salesforce.com/trailheadx/, must open in a new window (using the target attribute of ui:outputurl), and must be included in the Sales app. 

Here is my code 

Component : 

<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
    <aura:attribute name="myURL" type="String" default="https://developer.salesforce.com/trailheadx/"/>
    <br/><br/>
    <ui:outputURL value="{!v.myURL}" label="TrailheaDX" target="_blank"/>
    <br/>
</aura:component>



Controller : 


({
    navigate : function(component, event, helper) {
        var address = component.find("address").get("v.myURL");
        var urlEvent = $A.get("e.force:navigateToURL");
        urlEvent.setParams({
            "url": 'https://developer.salesforce.com/trailheadx/' + address
        });
        urlEvent.fire();
    }
})




In addition, i added the app to the utility bar and the homepage of the lightning sales app. 

Could you give me any pointers on how to finish this challenge? 


User-added image

User-added image