This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Initializing fullcalendar with appropriate option and handlers | |
* using Singleton Pattern | |
* */ | |
const CalendarSingleton = (function(){ | |
let calendarInstance; | |
function createCalendar(){ | |
//Initialize Full Calender | |
//and render inside 'calendar' div |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global class FullCalendarDemo{ | |
@RemoteAction | |
global static List<User_Calendar__c> getEvents() { | |
String userId = UserInfo.getUserId() ; | |
List<User_Calendar__c> userCalendar = [SELECT Id, Name, User__r.Name, | |
Event__c, Event__r.Name, Event__r.Start_Time__c, Event__r.End_Time__c | |
FROM User_Calendar__c | |
WHERE User__c=:userId]; | |
if(userCalendar.size()>0){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page lightningStylesheets="true" controller="FullCalendarDemo"> | |
<apex:stylesheet value="{!URLFOR($Resource.fullcalendar,'fullcalendar/fullcalendar.min.css')}"/> | |
<apex:stylesheet value="{!URLFOR($Resource.fullcalendar,'fullcalendar/jquery-ui.min.css')}"/> | |
<apex:includeScript value="{!URLFOR($Resource.fullcalendar,'/fullcalendar/jquery.min.js')}"/> | |
<apex:includeScript value="{!URLFOR($Resource.fullcalendar,'/fullcalendar/jquery-ui.min.js')}"/> | |
<apex:includeScript value="{!URLFOR($Resource.fullcalendar,'/fullcalendar/moment.min.js')}"/> | |
<apex:includeScript value="{!URLFOR($Resource.fullcalendar,'/fullcalendar/fullcalendar.min.js')}"/> | |
<apex:includeScript value="{!$Resource.FullCalendarDemo}"/> | |
<html> | |
<head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Class to demo new Url.getOrgDomainUrl() and UserInfo.getSessionId() methods | |
*/ | |
public class SameOrgApiDemo{ | |
//This method will make a call to same org | |
public static void getOrgLimits(){ | |
Http h = new Http(); | |
HttpRequest req = new HttpRequest(); | |
req.setEndpoint(Url.getOrgDomainUrl().toExternalForm() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This class will run in with sharing context if | |
* -It is visualforce page controller | |
* -It is entrypoint in the transaction (like api) | |
* This class will run in without sharing context if | |
* -It is being called from another class having without shring permission | |
**/ | |
public inherited sharing class InheritedSharing{ | |
public List<Contact> getAllTheSecrets(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data":{ | |
"event":{ | |
"createdDate":"2018-08-22T09:06:51.980Z", | |
"replayId":7, | |
"type":"updated" | |
}, | |
"sobject":{ | |
"Type":null, | |
"Phone":null, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
handleMessage : function(component, event, helper) { | |
const param = event.getParam('message'); | |
console.log(`Account "${param.sobject.Name}" with Id ${param.sobject.Id} is ${param.event.type}!!`); | |
} | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" > | |
<!--Include StreamingApiHandler child component and pass channel name to subscribe | |
ex: "/topic/AccountSpy" is my pushtopic channel name | |
once the event is fired, it will handled in handleMessage controller method --> | |
<c:StreamingAPIHandler channelName="/topic/AccountSpy" onStreamEvent="{!c.handleMessage}" /> | |
<lightning:card footer="Please check browser console for latest captured event" | |
title="Account Spy" | |
iconName="standard:search"> | |
<p class="slds-p-horizontal_small"> |