Skip to content

DHTMLX/salesforce-scheduler-demo

Repository files navigation

DHTMLX Scheduler demo for SalesForce LWC

dhtmlx.com License: GPL v2

Here you can find a code example of the event calendar for Lightning Web Components on Salesforce Platform.

The sample is implemented with the help of JavaScript Scheduler library - DHTMLX Scheduler.

Prerequisites

How to start

sfdx org login web -d
sfdx org create scratch -f config/project-scratch-def.json -d
  • Publish code
sfdx project deploy start
  • Open scratch org in browser
sfdx org open

The scratch org already has Scheduler app which you can check, or go to "Setup : Lighting Apps", create a new Lighting App and drop the Scheduler from the list of available components.

How to configure / modify

Backend

getEvents in force-app/main/default/classes/SchedulerData.cls returns list of events, adjust this query as necessary.

Frontend

force-app/main/default/lwc/scheduler/scheduler.js contains code of web component

function unwrap(fromSF){
    const data = fromSF.events.map(a => ({

unwrap functions controls how data from SalesForce is converted to dhtmlxScheduler compatible objects. You will need to modify this code if you will want to provide some additional data properties from SalesForce to the dhtmlxScheduler

initializeUI(){
        const root = this.template.querySelector('.thescheduler');
        root.style.height = this.height + "px";

        const scheduler = window.Scheduler.getSchedulerInstance();

initializeUI creates an instance of scheduler. This is the perfect place to configure the scheduler by using its API

scheduler.createDataProcessor(function (entity, action, data, id) {
    switch (action) {
        case "create":

createDataProcessor defines data saving rules, they need to be adjusted if you will want to save some extra fields along with the default Event's data.

Version of the Scheduler

force-app/main/default/staticresources/scheduler contains a trial version of the Scheduler ( it will show a warning message time to time ). For production usage you will need to replace js and css files in this archive with ones from enterprise/ultimate Scheduler package.

The earliest version of dhtmlxScheduler that is fully compatible with SalesForce LWC is dhtmlxScheduler v6.0.1.

Related resources

Support Us

Star our GitHub repo ⭐

Read us on Medium 📰

Follow us on Twitter 🐦

Like our page on Facebook 👍

About

Using dhtmlxScheduler in SalesForce LWC

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published