Evergreen: Serverless Functions & Compute for Customer 360 Platform

 

Delightful and cohesive digital experiences make for happy customers, partners and employees, and building those modern experiences requires direct and seamless access to Customer 360 data and business logic. That’s why we’re excited to announce Salesforce Evergreen — a new addition to the Customer 360 Platform that brings in serverless functions based on fully-managed Kubernetes, support for open programming languages and commonly used high-performance data stores. Evergreen is the best way to build the deep and engaging digital experiences that your customers have come to expect.

Evergreen supports technologies and architectural patterns that make development teams productive and happy:

  • Functions-as-a-Service for writing business logic and event processing in languages like Node.js, Java and Apex, using the full power of those languages’ package ecosystems. Functions can be triggered directly from Apex or using Platform Events, with many more invocation types and event sources to come.
  • Microservices for building serverless HTTP apps and APIs that can be quickly evolved by small agile teams and composed into complex, engaging digital experiences. Services and functions are serverless, consume no resources when idle and automatically and elastically scale with traffic.
  • Managed data stores like Postgres, Apache Kafka and Redis that complement the Salesforce Data APIs for high-performance persistence and real-time eventing.

As an industry first, these features come with built-in customer context, driven by the Salesforce data model and low-code components. Evergreen is a seamless part of the Salesforce platform and no extra authentication or networking setup is required. For example, developers can invoke functions directly from Apex, run logic with org-context and query and write-back updates.

 

Evergreen is based on Kubernetes and balances control and access to scalable container technology by providing a fully managed serverless service operated by Salesforce. This service lets you focus more on innovation rather than infrastructure operations. Evergreen opens Salesforce development to any development team because apps, functions and services can be built using common open languages, tools and technologies.

At the Dreamforce 2019 Developer Keynote, we showcased how Salesforce customers like Caesars Entertainment can build a modern guest check-in experience using Evergreen. In the keynote demo, the Lightning Platform is used to quickly create an employee-facing iOS app for managing housekeeping and room-readiness and that is seamlessly extended with event-driven functions running on Evergreen. When housekeeping marks a room as ready using the employee app, a platform event triggers a Node.js function that uses guest-context to send a tailored real-time notification letting the guest know that the room is ready for early check-in.

At the end of the stay, the Salesforce Flow powering the guest checkout can call out to a different function with invoicing details. The Node.js function can use the invoice details and an npm PDF module to quickly generate a bill. Here’s the sample function that receives the request as a CloudEvent fetches additional data, generates a PDF and adds a link to the PDF from the guest booking record:

import { UnitOfWork, SObject } from '@salesforce/functions';
import { PDFDocument } from 'pdfkit';
import * as fs from 'fs';

module.exports = async function(event, context, logger) {
    const folioPayload = event.payload;

    // Creating a new Unit Of Work instance
    const uow = UnitOfWork;

    // Run SOQL query to fetch folio data
    const query = `SELECT Id, Description__c, Amount__c, Date__c FROM Booking_LineItems__c WHERE Reservation__c = 
    '${folioPayload.recordId}'`;
    const folioLineItems = await context.sfApi.query(query);

    // Call function to generate PDF and store in external data store
    // for Files Connect
    const pdfFilesConnect = await generatePdf(
        folioPayload.recordId,
        folioLineItems
    );

    // Update the booking object
    const ReservationObject = new SObject('Reservation__c');
    ReservationObject.Id = folioPayload.recordId;
    ReservationObject.Status__c = 'Paid and Folio created';
    uow.registerModified(ReservationObject);

    // Update data
    uow.commit();
};

async function generatePdf(id, lineItems) {
    # generate and store folio PDF
}

Functions running on Evergreen idle when not in use and automatically scale to handle any invocation load or event throughput. Functions are easy to build from source with Cloud Native Buildpacks and developers are free to use any supported programming language and to pull in any package or library that’s going to help them get their job done.

Evergreen is the latest addition to the Salesforce Platform, combining Heroku’s decade-long experience building scalable container runtimes and high-performance data stores with Lightning tools and features. The unique combination of serverless, elastic container technology and seamless access to customer data and low-code business logic makes Salesforce the obvious place to build and run the differentiated digital experiences that impress your customers, partners and employees.

A limited access developer preview of Evergreen will be available with the Spring ’20 release in February. Sign up to get Evergreen updates. You can also watch the Dreamforce Developer Keynote recording to see an Evergreen demo. If you’re joining us on-site at #DF19, drop by the Dreamforce Evergreen booth at Platform Park in the Trailhead area (At Moscone West) to learn more, or join us for these Evergreen-focused Dreamforce breakout sessions:

Leave your comments...

Evergreen: Serverless Functions & Compute for Customer 360 Platform