Category: Salesforce

Transactional Messaging: Send Your Most Important Messages

It’s been said that transactional messaging is an incredible tool to increase customer engagement. Can it really make such a big impact? We know that today, consumers expect real-time communications from the brands they interact with. Examples of such messages include order confirmations, account alerts, identity verification, time-triggered reminders, and other messages with expectations of immediate delivery. The bottom line is that companies must be able to quickly respond to their customers’ ever-changing needs for information and services, otherwise they risk losing loyal customers.

Critical messages need to be delivered in a timely manner in order to effectively inform and communicate with customers, and at the same time, these messages must honor compliance and data privacy. So how can Salesforce help?

Set up your transactional messages

By easily integrating in-house applications to a robust messaging service, companies can quickly roll out new types of transactional messages using Salesforce Marketing Cloud. Developers can integrate into a simple interface that powers their marketing team to deploy email, SMS, and push messages fast.

Here is an example:

Megan, a customer of Local Credit Union, needs to access her bank account but has forgotten her password. She decides to reset her password using her email address, which was previously stored in her credit union account. She receives an email immediately asking her to verify her password change request.

In this example with Megan, we have a person-initiated single message confirming the completion of a process with expectations of immediate delivery. The credit union can push the password approval back to Megan in near real-time.

In another example, Steve is a customer of College Choice 529 and updates his personal account information on their website. Afterwards, Steve receives an email message confirming the information has changed in his account and notified Steve to call the customer service if he did not initiate the change.

In Steve’s example above, there was a system-initiated single notification message triggered by an application, immediately when the event occurred. This is how Steve was able to receive such a timely email from College Choice 529 informing him account updates have been made.

So how does this all work? Salesforce offers easy-to-use RESTful and SOAP APIs for sending messages and retrieving send status. Messages are processed and deployed in near real-time, with predictable deployment in email or SMS channels. Additionally, content creators will be able to leverage Content Builder to easily extend their branding to transactional messages.

The great news is you can start using the new Transactional Messaging APIs right now! Developer documentation will have you integrated and sending in no time. Please join our Marketing Cloud Developer webinar on August 2 to hear how to leverage transactional messaging and see it in action from our product experts.

To learn more about these APIs in Trailhead, check out the Platform Development Basics module.

Finally, for more developer resources on all things Marketing Cloud, check out our newly launched Marketing Cloud Developer Center.

Extending Your Data Model

The Salesforce Marketing Cloud is an impressively powerful platform that enables marketers to create a 360-degree view of their customers, engaging with them in truly personalized and meaningful ways. In order to fully leverage the functionality of the amazing feature-set available within the Marketing Cloud, your organization will need data – lots of data! However, we all know that when a lot of data is introduced into the equation, things can get rather complicated. I’m here today to help you navigate the data management waters of the Marketing Cloud so you can ensure your customers are always receiving the right content at the right time.

Data management 101

One of the best aspects of the Marketing Cloud is the ease in which it can ingest data – from all types of sources. The flip side of this is, well, the platform can easily ingest data from all types of sources! This double-edged sword can present potential pitfalls for teams who err on the side of the ‘bringing everything into the platform’ mentality – many will quickly find themselves struggling to access the valuable customer data they’ve worked so hard to acquire.

The easiest and most straightforward means of avoiding this scenario is to keep things simple when it comes to importing data into the Marketing Cloud. I know, much easier said than done, right? Let’s walk though a specific use case on paring down your data, as this may help provide a concrete and actionable example of how to adopt the ‘less is more’ mindset.

Less is more: Sales Cloud + Marketing Cloud sync

One of the most valuable aspects of the Salesforce ecosystem is the ability to connect and share data across the various Clouds. In this case, we’ll explore the Sales Cloud and Marketing Cloud sync, which allows organizations to synchronize their CRM data to their Marketing Cloud instance.

For example, this particular feature allows marketing organizations to import their Sales Cloud Contacts, Leads, Person Accounts, etc. into Marketing Cloud for subsequent use in campaigns. Once you have established the connection between Sales Cloud and Marketing Cloud, it’s easy to synchronize customer data, as shown here in this example of Contact attribute selection:

In the above image, users have the ability to easily select customer attributes from their Sales Cloud instance for sync with the Marketing Cloud. It’s so easy, in fact, that one could quickly select all attributes for import. In this particular example, a user could import all 241 attributes from their Sales Cloud Contacts records in a matter of only a few clicks. Incredibly powerful and easy to use? Absolutely. Will marketing organizations leverage every single attribute of the 241 available? Probably not!

This is why less is more is so important when managing your customer data. Although it’s easy to include everything, it’s best to stick to only what you need. Including data that you will seldom or never use will only make it that much more difficult to find the data that

Introducing the Sample Gallery

Exploring sample applications is a great way to learn new languages, frameworks, and platforms. That’s why we built the Sample Gallery: a collection of reference applications that demonstrate how to build apps on the Salesforce platform. In this blog post, we introduce you to the new Sample Gallery and show you how to make the most of it.

The Sample Gallery brings together core sample applications under one roof, on one convenient page. The apps in the Sample Gallery provide a blueprint or a reference architecture for building apps on the Salesforce platform. They have two key objectives:

Inspiration: Show you WHAT you can build (art of the possible) Learning: Show you HOW to build it (coding best practices)

To achieve these goals, the Sample Gallery apps are continuously updated to incorporate new platform features and implement the latest best practices.

What’s different about building apps on the Salesforce Platform?

Every application has a set of core requirements: identity management, data security, data entry, analytics, process automation, mobile, social integration, Artificial Intelligence (AI), etc. What’s unique about building apps on the Salesforce platform is that it provides a state-of-the-art, metadata-driven, and trusted implementation of these application services. As a developer, that means you can focus on high-value features and innovation, not commoditized features and infrastructure. The Sample Gallery apps show you what you can build without code, and provide examples of these higher value and innovative features you can build with code. To cover a wide range of use cases, each app focuses on a different industry.

DreamHouse

Industry: Real estate

The DreamHouse app helps real estate brokers manage their properties and their customers. The application also helps prospective home buyers find their dream house via a custom mobile app. Regardless of the industry you work in, this app demonstrates how to build rich and immersive user experiences with Lightning Components.

Features highlighted:

Custom Lightning components Lightning Data Service Einstein Vision (visual house search) Process automation with Process Builder Employee-facing mobile application with the Salesforce mobile app Customer-facing mobile application with the Mobile SDK Bot integration (Alexa, Slack, Facebook Messenger) IoT integration (smart lights, smart locks, smart thermostat) Northern Trail Outfitters

Industry: Retail

Northern Trail Outfitters (NTO) is a fictional outdoor clothing company. The application helps NTO merchandisers create “merchandise mixes” for their large retailers . A merchandise mix is a collection of products a retailer carries for a season. Merchandise mixes are submitted to a Heroku-hosted manufacturing app using platform events. The app demonstrates how to build applications with Lightning components and how to use platform events to integrate with external systems.

Features highlighted:

Custom Lightning components Rich interactions: drag and drop Storable actions Data caching Integration with Platform Events Third-party Javascript library integration (ChartJS) Heroku interoperability (Manufacturing app) DreamInvest

Industry: Financial services

DreamInvest helps financial advisors find mutual funds based on several criteria (return, sector, etc). This app demonstrates how to build configurable Lightning components that even Salesforce admins can use to create sophisticated

Customize and Extend the Content Builder Platform

The Salesforce Marketing Cloud allows you to connect with your customers through personalized messages across multiple marketing channels, including email. Email is the highest return on investment (ROI) marketing channel and with Marketing Cloud, users can create great email content using code, low-code, and no-code.

To create and edit content, Marketing Cloud users leverage Content Builder to build content using drag-and-drop content blocks. With the Spring’18 product release, customers and partners can now create custom content blocks to meet their specific needs using the Content Block SDK.

This year at TrailheaDX, we introduced the Content Builder Block SDK, which allows developers and partners to create content blocks. The goal is to scale your efforts and empower your marketing team without starting from scratch for each campaign! By creating reusable content, you give your marketers the power to build engaging messages without multiple requests.

So today, let’s take a closer look at how the new block SDK will allow all of you — our developers, partners, and customer marketers — to create custom editor blocks to meet your specialized content creation and workflow needs.

Let’s start with the basics.

How does a block widget work?

In its basic form, a block widget is an HTML page that the editor renders in the widgets section. You can host and serve the block widget as an HTML page from anywhere, then add it as an installed package component in Marketing Cloud. When a user provisions the package, the editor shows the block icon as an available custom block. When the user drags the block icon onto the editor or edits a previously created content block of this type, the block widget’s HTML page opens in an iFrame.

A couple of things to note:

Blocks appear in the custom section of the Blocks tab in the editor. When added to the canvas, the external application is displayed in the editor in an iFrame and it interacts with the content being edited in real-time just like a native block. To the user, it should look and feel just like any other block. Blocks are provisioned via AppExchange (partner blocks) or directly via Installed Packages (Services teams or customer-built custom blocks).

To give your users a customized editing experience within the Content Builder editor, you can develop custom block widgets with the Content Block SDK. For example, instead of using the default text block for HTML editing, you could use a different WYSIWYG, like QuillJS, by making a block widget for it.

How does the Content Block SDK work?

This SDK is intended to simplify content block development for the Marketing Cloud Content Builder editor. It provides domain validation using cross-document messages to interact with the editor. To facilitate the communication with the editor, the Content SDK exposes available interactions as simple Javascript methods.

Content creation partners can create blocks as a way to integrate their products with Content Builder, allowing users to leverage their capabilities directly in the editor versus creating content in

Which Streaming Event Do I Use?

With so many different flavors of streaming events, how do you choose the right one for your use case? In this post, we’ll talk about the use cases for each type of event and compare features across the different streaming events. Some events are used to generate notifications corresponding to Salesforce record changes, and other events are used to generate custom notifications.

What are streaming events and why use them?

Events are notification messages that are sent from one system (the publisher) to another (the subscriber). Using the publisher and subscriber model and push technology, notifications are sent to the subscriber in real time, ensuring freshness of data.

Push technology is the opposite of pull technology. With pull technology, clients request data from the server periodically. When systems are connected through pull technology, clients poll the server frequently. The received data might not always be the latest because it depends on the pull frequency. In addition, clients might make unnecessary calls and can cause server slowdown.

Streaming events connect disparate systems efficiently with Salesforce and deliver real-time data. By using an event-driven software architecture, you streamline the communication between enterprise systems. Clients can subscribe to an event channel to receive notifications.

What data is sent in streaming events?

Streaming events include Salesforce record changes or custom data that you specify. PushTopic events are published when a Salesforce record changes as a result of create, update, delete, or undelete operations. Alternatively, you can publish arbitrary data and subscribe to the stream of data using platform events or generic events.

Subscribe to Salesforce record changes

The Lightning Platform publishes real-time notifications when record changes occur through PushTopic events. Imagine each notification of a record data change to be like radar detection of a nearby object. Apps can subscribe to receive such notifications and take appropriate action, such as replicating Salesforce record data from Salesforce to an external system.

What is a PushTopic event?

A PushTopic event is a notification that Salesforce sends when a change to a Salesforce record occurs as part of a create, update, delete, or undelete operation. The notification is based on an SOQL query that you define. Changes are evaluated for fields specified in the query SELECT and WHERE clause. Notifications include the fields from the SELECT clause. The query’s maximum length is 1300 characters. PushTopic events support all custom objects and a subset of standard objects.

For example, this query causes notifications to be sent for account record changes. Each notification includes the account’s ID, Name, and Phone fields.

SELECT Id, Name, Phone FROM Account

Event payload example

This PushTopic event JSON message is sent when an account is created. The fields included in the event message are the fields specified in the query’s SELECT clause. Notice that Phone is null because no phone number was populated for the new account.

{ “data”: { “event”: { “createdDate”: “2018-06-12T18:03:54.018Z”, “replayId”: 8, “type”: “created” }, “sobject”: { “Phone”: null, “Id”: “0015000001YlEaqAAF”, “Name”: “Acme” } }, “channel”: “/topic/AccountUpdates”

A Declarative Rollup Summary Tool for Force.com Lookup Relationships

Note: This article was originally published on developer.salesforce.com in May 2014.

I’ve recently been asked to share the motivation and vision that emerged around an open source package I’ve been developing over the last year or so. It all started with a bunch of code and an API looking for a problem to solve, to be honest! Here I will take you through the journey that led to the Declarative Rollup Summary Tool being born and ended up helping to fill a six-year-old platform feature itch. By the way, relating to the desire to roll up values between records related via standard Lookup fields and not just Master-Detail (where platform support already exists), the related Salesforce Idea has over 20k upvotes!

The reality is this gap is being filled through Apex developers writing specific Apex Trigger code for the desired objects and fields utilizing SOQL Aggregate queries (ideally) to grab and recalculate the summarized values as the child records are updated. Then cracking open the same Apex Trigger code to repeat the process for other objects and/or making subsequent changes to the fields or criteria as requirements change. So the traditional approach to this problem carries some overhead in terms of skills and process and does not allow for easy adaption of the implementation once its in place, compared to the way editing a standard roll up summary would declaratively.

As I have discovered through FinancialForce.com’s utilization of its ClickLink package, putting more declarative power into the hands of not just developers, but business process owners, solution architects, admins and consultants makes for a better collaboration and resulting solution. Such an approach empowers more people to not only define the requirements, but be part of creating the solutions! The idea of applications that enable this beyond the declarative capabilities of the platform is something I’ve shared before here, Declarative Thinking: Apps to Build Apps.

So you’re probably wondering at this point, how did I manage to do something declaratively that Salesforce has not done so far for six years? Well first of all, I’d like come clean and say, I doubt that you went through 200+ comments on that idea — all requirements would be possible with this package. However, so far, it’s had a pretty good success rate! So functional caveats aside, I must now let you into a secret as to how it’s done behind-the-scenes.

So they say there is no escaping reality and sure enough, as per the current workaround to this platform gap, code is indeed involved! So the little secret here is that clicks not code requires code! In this case, code that leverages an excellent open source library by fellow MVP Abhinav Gupta, who back in 2012, had realized the same gap and provided a great Apex library for helping developers write Apex Trigger code to implement roll ups.

His library wraps the use of SOQL Aggregate queries to allow the Trigger developer to more easily express a rollup requirement in a similar way as to the standard roll ups available on

Get Your Learning On Before The Main Event with New Pre-Dreamforce ’18 Bootcamps!

Going to Dreamforce this September? Want to skill up and get certification-ready? We got you! Make the most of your #DF18 experience and immerse yourself in 3 days of hands-on learning with Trailhead experts by signing up for a NEW pre-Dreamforce Bootcamp.

You’ll have seven tracks in all to choose from to tickle your learning tastebuds. This year, we’re presenting four developer-specific Bootcamps including Coding for Admins, Platform Developer I, Developing Applications using Salesforce DX and Heroku Pipelines, and Commerce Cloud Digital Developer.

Developer-based Bootcamps to fit your needs

Join us and you’ll get to work through real code samples alongside your fellow developer Trailblazers, supported by expert instructors from Trailhead. Whether you’re writing your first Apex class or learning Javascript for Commerce Cloud, we have a developer-based Bootcamp for you.

Here’s what you’ll learn in our developer-focused Bootcamps:

Coding for Admins
You’ll learn the fundamentals of implementing business logic using Apex, the object-oriented programming language of the Salesforce Platform. First, you’ll learn how to read Apex code, then you’ll gradually increase your programming skills from writing single debugging statements to programming multiple, multi-line blocks of code. Platform Developer 1
You’ll learn how to customize your Salesforce applications using programming languages supported by the Salesforce Platform, then get hands-on experience building data objects and writing Apex code to retrieve, manipulate, and store the data associated with those objects. This track culminates in a learning exercise where you’ll build a complex trigger that takes advantage of the declarative aspects of the platform. Developing Applications using Salesforce DX and Heroku Pipelines
You’ll get hands-on experience with the newest Developer tools and learn how to develop and manage applications using Salesforce DX and Heroku. You’ll learn how to build Salesforce DX projects and use scratch orgs, unlocked packages, and source control tools. You’ll also explore continuous integration using Salesforce DX and Heroku Pipelines. Commerce Cloud Digital Developer
You’ll learn the core programming concepts, relevant files, and scripting language for Commerce Cloud Digital by learning how to customize the SiteGenesis reference application and modify a Commerce Cloud storefront.

Get certified for 50% off at Dreamforce

Not only is Dreamforce ’18 the place to get your learning on but you can also become a #CertifiedPro (or more certified as the case may be). The Dreamforce special certification pricing means you’ll get 50% off your exam cost.

How? Simply register for your certification when you complete your Dreamforce registration. Then choose your exam time when the Agenda Builder goes live before the event. Exam sessions start the Monday before Dreamforce kicks off and run throughout the week.

Pro tip: Check out our secrets for acing your certification exam, including prep tips and expert advice for acing the exam.

Start your Dreamforce journey a step ahead

Start your Dreamforce ’18 experience by getting hands-on with the products you use everyday or with the newest Developer tools like Heroku Pipelines and Salesforce DX, and you’ll be setting yourself up to be a step ahead on your learning journey.

Your

noimage

How Variable Types Operate in the Lightning Component Framework

When writing a component or application, you can set an attribute to have a specific type. But how is the type being used by Aura, the underlying framework of Lightning Components? What benefits do you get from choosing one type over another? What pitfalls do we have to look out for? Lastly, how does the selection of these types impact how the data can be communicated to and from the server?

Choosing the right type for the job is a core decision when building an API, so let’s take a look under the hood.

In this article, we are going to look at how components operate with four different kinds of variable types and why it is important to make them a distinct type. This article assumes you have a working knowledge of using Lightning Components. If you are new to Lightning Components, running through the Lightning Basics Module on Trailhead would be a good start.

Specifying the type of your attributes

When specifying your attributes, it is a good thing to remember that even though you write your components in JavaScript and markup files, the Aura Framework is written in Java. Thus metadata about your component, such as its attribute types are going to map back to something the Java backend of Aura can understand.

When it comes to choosing a specific type for your component, it’s particularly important to understand that the type is related to a Java definition of the type, not JavaScript. So Object here refers to java.lang.object, not JavaScript’s window.Object, String relates to java.lang.String, Map to java.util.Map, etc.

Let’s start on the client. An attribute is defined by two properties name and type:

<!– myCmp.cmp –> <aura:attribute name=”myString” type=”String”/> <aura:attribute name=”myObject” type=”Object”/> <aura:attribute name=”myMap” type=”Map”/> <aura:attribute name=”myFacet” type=”Aura.Component[]”/>

Let’s review each attribute individually:

myString attribute

<aura:attribute name=”myString” type=”String”/>

Your basic String attribute. Nothing fancy.

myObject attribute

<aura:attribute name=”myObject” type=”Object”/>

As we said earlier, the Types are mapping back to Java Types. So this is specifying that the value in this attribute is of type java.lang.Object, which is potentially problematic. While the Aura Framework client will not be affected, on the server the type Object might not get converted to the correct data type we expect.

On the server, we’ll use something called the Aura Converter Service to convert values from one type to another. In this case with type=”Object” it will ignore any conversion for this attribute, possibly resulting in the incorrect data type being present. This example might compile and run initially, but could easily break down the road. If using a generic base type is desired, avoid Object as it means different things to JavaScript as it does to our Java Services. So instead of Object, use Map.

We’ll give further examples of how this can fail further in this article.

myMap attribute

<aura:attribute name=”myMap” type=”Map”/>

Here we’re using Map, which will properly handle data conversions from client and server.
A key value store that will

10 Tips for Implementing an Efficient Lightning Lookup Component

A Lightning lookup component is a text field with autocompletion and a dropdown. There are several different ways to create these for Lightning Experience, but a few best practices emerge.

In this blog post, I will present ten technical decisions and best practices that drove the implementation of a custom Lightning Lookup component that I contributed. Even if you do not plan to build your own lookup component, you may learn valuable information that you can apply to other projects.

Here is an overview of the themes that we will cover:

Third-party libraries Salesforce Lightning Design System Conditional rendering methods Performance and scalability Search optimization Flexible and reusable architecture Avoid using third-party libraries for basic UI needs

When building a custom lookup component, it can be quite tempting to go for simplicity and grab a component from a third-party library. For example, there are quite a few examples of components using jQuery or AngularJS.

Although this is convenient because it reduces the development effort, keep in mind that loading such libraries adds an overhead that affects performance on the client side. This extra cost is not justified when displaying a simple lookup component because you can easily achieve this with basic HTML and JS. As a side note, using a third-party library may also prove problematic when styling your component.

I recommend that you only use third-party libraries when the requirements are complex enough to justify it (e.g. displaying maps or charts).

Use the Salesforce Lightning Design System

If you create a custom component you should use the Salesforce Lightning Design System (SLDS). It guarantees that your component will have the proper style, be responsive and be accessible.

SLDS provides component blueprints that allow you to start from a static HTML template that has the proper CSS classes applied to it. Creating a component is a matter of copying the blueprint and turning into something dynamic with some JS.

One of the important bits to remember when copying blueprints is to maintain the accessibility of your component by generating dynamic unique IDs. This allows assistive technology such as screen readers to link labels with their corresponding fields. It helps disabled users to access and use your component.

You can easily achieve this by replacing the provided hard-coded IDs with expressions like this:

<label for=”{# globalId + ‘_input’ }” …>…</label> … <input type=”text” id=”{# globalId + ‘_input’ }” …/> …

In this sample code, we use an unbound expression combined with the globalId keyword to generate unique IDs even if there are multiple instances of our component on the same page.

The value of an unbound expression is never re-evaluated.

The unbound expression denoted by a # symbol is used to generate a constant value. Unlike bound expressions denoted by the ! symbol, the value of an unbound expression is never re-evaluated. That holds true even when the value of attributes that compose the expression changes. This static behavior brings a performance gain.

We also use

noimage

What’s New with Locker Service

If you’ve been using Salesforce for a while, you know that trust is one of our highest values. We want you to feel safe leveraging the Lightning Platform, even in the midst of scary computer security stories. That is why we developed Locker Service, and this blog post is going to help illustrate everything you need to know about the enhancements we’ve been making.

Why you need Locker Service

Computer security had a rough year. We witnessed data breaches at Uber and Equifax, to name just two incidents at large companies. Vulnerabilities labeled Spectre and Meltdown were found in Intel and AMD microprocessors. Google had to take down over 700,000 Android apps and Facebook is under FTC investigation over its handling of user data.

Each one of these businesses invests a tremendous amount of effort into security. Still, they make the news and face challenges because of fundamental changes in computing.

Specifically:

Barriers are disappearing between business entities, between office and mobile, and between hardware and software. Everything is available digitally using some process, somewhere in some system, because all valuable information eventually gets computerized.

The browser is our primary portal to this interconnected digital world. Although modern browsers evolve rapidly to fix security holes thanks to auto-update, several new security practices are still optional or even incomplete. That’s where Locker Service comes in.

Locker Service is a virtual browser that sits in front of the real browser to ensure safe code execution. It’s a layer that disables unsafe browser features or replaces them with a secure version.

Meltdown and Spectre can be exploited via JavaScript code in order to read anything that’s loaded into memory, including passwords. The exploits require clever use of a feature named SharedArrayBuffer .
Although some browsers have disabled SharedArrayBuffer by default, Locker Service ensures that it’s completely unavailable beginning Summer ‘18.

Trick: Use the Locker Service API (URL) viewer to quickly discover what features are supported.
If you are facing an issue with compatibility, check whether the API you need is listed in red (which means it’s not supported) or in orange (in that case, it’s supported but using a different behavior than the browser API).

Login sessions

Every time you log in to a website, a session is established so you don’t have to log in again for every page load. The browser usually stores sessions in cookies and all cookies are stored in a “cookie jar.” Locker Service protects the cookie jar from unauthorized use, but previously had to disable “unsafe-eval” with Content Security Policy (CSP) to make that protection effective.

Beginning with Summer ‘18, Locker Service provides a safe eval() and a safe Function() to improve compatibility with third-party code while maintaining full protection, and turning on CSP doesn’t disable those APIs anymore.

For example, templating engines can really improve the maintainability of a project when creating HTML. To accelerate the output, those engines often use Function() to produce a compiled version.

If your project depends directly on a templating engine (such as