• MCord
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 4
    Likes Given
  • 1
    Questions
  • 2
    Replies
The Topic Catalog Component proves that it is possible to create a component that lists out just the nav topics. How do we replicate this?
  • April 03, 2018
  • Like
  • 0

I would like to customize the article type layout that is used when a Knowledge article is viewed in a community.

I know how to do this for the standard Knowledge interface in Salesforce, but not in communities.  Can anyone point me to documentation or let me know how to get started?

Thanks,
Jenna

Is there any way to use SOQL on the Topic standard objects to know which topic is a featured topic and which is a navigational topic?
Dear all,
I am facing one issue in static resource.
I am referencing a static resouce in Lightning component.
I have updated a css file in the static resource, but still the old css is loading in lightning application.
I have tried clearing browser cache, but still the old one is coming.
Kindly help me in solving this.
Thanks in advance
trigger EventTrigger on Event (before Insert, before update) {
        public static String communityId=Network.getNetworkId();
        
        if(trigger.isInsert){
            if(communityID!=null){ 
                String CommunityName=ConnectApi.Communities.getCommunity(communityId).name;
                //Update public calendar events for HR4HR community
                if(CommunityName=='HR4HR'){
                   publicCalendar__c pc = [SELECT ID__c FROM publiccalendar__c WHERE Name=: 'HR4HR Community Calendar'];
                   
                   for(Event e:trigger.new){
                       e.OwnerID=pc.ID__c;
                   }
                }
                
                //Update public calendar events for Tech Exchange community
                if(CommunityName=='TechExchange'){
                   publicCalendar__c pc = [SELECT ID__c FROM publiccalendar__c WHERE Name=: 'TechExchange Community Calendar'];
                   for(Event e:trigger.new){
                       e.OwnerID=pc.ID__c;
                   }
                }
            }
        }
        
        if(trigger.isUpdate){
           if(CommunityID!=null){
                for(Event e:trigger.New){
                    if(!(Trigger.OldMap.get(e.id).ownerId==e.ownerId)){
                        e.ownerID.addError('Assigned To field cannot be edited');
                    }    
                }
                
               
            }
            
        }

}

Above is my class and below is my test class.
 
@isTest(seeallData=true)
 public class EventTriggerTest{
  
  
  public static testMethod void testEventTrigger(){
        Network community;
        String communityId;   
        
        Id currentUserId = UserInfo.getUserId();    
        User usr = [select id,Name from User where id =: currentUserId]; 
        
   
     system.runAs(usr){
    community = [SELECT id, Name,OptionsReputationEnabled FROM Network where name =: 'TechExchange'];
        communityId = community.id;
     
    system.debug('Test User Inside Network'+network.getnetworkid());
       
      Event eve = new Event(
            // OwnerId= usr.Id,
             ActivityDate=system.today(),
             StartDateTime=system.now().addhours(35),
             EndDateTime=system.now().addhours(36),
             Subject='Test',
             Description='Testing the event controller'
                               );
      insert eve;
      
      Event e = [Select id, Subject from Event where id=:eve.id];
       
       System.assertEquals('Test', e.subject);
       e.subject='New';
       update e;
       
         
    }

     
  
  }
   
 
  

 }

 
Is there any way to use SOQL on the Topic standard objects to know which topic is a featured topic and which is a navigational topic?
Is it possible to set the networkid of a running user in a unit test?

I created a test user in a unit test with a profile that only has access to 1 community. Running a test as this user using system.runas(user) still has network.getnetworkId() returning as null. I've tried setting the users networkId both using User.networkId = networkid and User.network.Id = networkid and neither work (invalid foreign key relationship). Is there somewhere in the test I can define what network to run the test under? Any other ideas?