• Oliver Freeman 29
  • NEWBIE
  • 0 Points
  • Member since 2017
  • Salesforce Developer
  • oe:gen

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

Hi there,

I'm currently looking for an example of where someone has created a Lightning Community and has implemented some form of "Cookie Consent" Lightning Component for their community - so in this case, we're looking at a public community, that anybody has access to.

By law in the UK, we're required to have some form of "Cookie Consent" message on any public-facing website, which a community would fall under, so I figured I'd post on here because I've not been able to find any examples of community implementations where a "Cookie Consent" component has been implemented.

If anyone has any exampes/advice to offer, it would be greatly appreciated.

Thanks,

Oli

Hey,

In the past we've hosted content for the My Domain Right-Frame on our Hubspot website on their own pages. We're looking to now host the content for this in Salesforce in a community (unauthenticated/public). To achieve this, I've built a lightning component that will allow users to upload a static resource with multiple images, and the component will randomly select one of the images in the resource to display. My thinking was that I could add this component to an unauthenticated community and set that community URL to be the Right-Frame content URL in My Domain in Salesforce - when I do this, the right frame content just doesn't display, and the console shows an error - Refused to display [URL] in a frame because it set 'X-Frame-Options' to 'sameorigin'. I thought that this was down to Clickjack protection, which I've now disabled in the site settings, but that doesn't make a difference.

Any help would be greatly appreciated,
Thanks,

Oli

Hey,

I'm currently working on implementing a time off booking system for our internal Salesforce org.
We have two different Business Hours records which reflect our two different working hours for employees - M2F - Monday to Friday, and M2T - Monday to Thursday.
We don't take holidays by the hour, we take them either in half days, or full days, so those business hours records are used purely for the holiday booking system, and to make things easier, are set to 24Hrs for each day worked in that particular record.

My idea was to use an APEX trigger to calculate the difference in business hours based on the particular users specified (at the User object level) business hours record - this works fine, however, if I try to create a 'Time Off' record that is 4 days in duration, the returned 'Number of Days' from my BusinessHours.diff calculation(s) is 3.96 days, not 4.

See my method here:
 
public static void calculateDays(List<Time_Off__c> timeOff){
        List<Time_Off__c> tu = new List<Time_Off__c>();
        for(Time_Off__c t:timeOff){
            Time_Off__c to = new Time_Off__c(Id=t.Id);
            String userBh = [SELECT Id, Business_Hours__c FROM User WHERE Id = :t.User__c LIMIT 1].Business_Hours__c;
            Id bhId = [SELECT Id, Name FROM BusinessHours WHERE Name =: userBh].Id;
            Long diffMs = BusinessHours.diff(bhId, t.Start_Date__c, t.End_Date__c);
            Double hours = diffMs/3600000;
            Double days = hours/24;
            to.Number_of_Days__c = days;
            tu.add(to);
                }
        update tu;
        
    }


Any help would be massively appreciated :)

Thanks,
Oli