Category: Salesforce


ICYMI @ TrailheaDX’18: 4 Session Videos About Process Automation

Salesforce makes it simple to automate processes in your apps and make experiences seamless for your customers. As a developer, there is much more you can do with Lightning Flow. In addition to utilizing the tools in Lightning Flow — Process Builder and Cloud Flow Designer — you can use Apex when you need more functionality.

We talked a lot about Lightning Flow and other automation tools at TrailheaDX’18 so we wanted to share recordings of a few sessions. Take a look at these videos and learn how to become an automation master!

Introduction to Lightning Flow  

The best way to learn about Lightning Flow is to just get started! Learn from product management VP Arnab Bose and product marketing manager Wendy Lee on how to build rich, engaging, and guided visual processes to automate your business and how to utilize Lightning Components to orchestrate dynamic screens. (Level: Beginner)

Go with the Flow: Top UX Tips for Lightning Flow  

Learn the top three tips for building user-friendly experiences in Lightning Flow. Principal UX designer Owen Schoppe talks about them in this presentation. (Level: Beginner)

Bring Engaging Experiences to Life with Lightning Flow  

Arnab Bose, senior product management director Alex Edelstein, and principal software engineer Nathan Lipke talk about how you can create powerful, versatile, and visually pleasing process-based apps with Lightning Flow and base and custom Lightning Components. (Level: Intermediate)

Orchestrate Multiple Processes and Flows with Platform Events  

Platform Events is an enterprise messaging system and one of its many functions is allowing flows to communicate with each other. In this presentation by Nathan Lipke and product managers Jason Teller and Jay Hurst, you’ll learn how to coordinate multiple flows by using platform events (Level: Intermediate)

Watch and share all the videos here!

More resources

For more on Lightning Flow, be sure to complete the Lightning Flow module on Trailhead. Also, if you missed out on our Developer Preview Live webinar on May 25th, you can watch it here on-demand. One of the topics we discussed was what’s new in Lightning Flow for the Summer’18 release!

For more on Platform Events, check out the Platform Events Basics module on Trailhead.

Check out other posts in this series

This marks the end of our ICYMI @ TDX18 series but don’t worry, we’ll be launching our Call for Presentations for Dreamforce 2018 real soon! Perhaps we’ll see your session in a blog series. Stay tuned, and thanks for revisiting TDX18 with us!

Integrate External Content into Communities Using CMS Connect JSON

A strong digital identity allows you to be close to your customers across channels. But it’s often a frustrating process when it comes to delivering, managing, and optimizing experiences consistently across every digital touchpoint.

That can sometimes involve having to recreate content, branding or blogs on your various systems. If you have to regularly update that content, it quickly becomes a costly and repetitive manual task to keep your different systems in sync.

This will no longer be the case if you use CMS Connect. CMS Connect allows all of our Community Cloud customers to leverage their existing content and pull it in dynamically into their Lightning Communities. It lets you centralize your content in whatever CMS system you’ve chosen, without having to re-create content when you want to leverage it in your communities. You’ll save hours of time and effort as you manage your digital experiences!

CMS Connect can pull content from Adobe Experience Manager, WordPress, Drupal, Sitecore, SDL, and others that support content structured as JSON or HTML fragments.

This blog focuses on CMS Connect (JSON). For CMS Connect (HTML), see Connect Your Community to Your Content Management System.

You might be wondering when to use CMS Connect JSON and when to go for HTML.

CMS Connect (HTML) allows you to integrate fragments of your HTML web content (i.e. headers, footers, and banners, etc) to have the same branding experience of your website into your communities. CMS Connect (JSON) is best for when you want to bring in content lists (i.e. blogs, articles, product catalogs, files, etc) including authenticated content.

While this post discusses WordPress as an example, it applies to any CMS that supports JSON.

Let’s get started walking through how you set this up in your Lightning Community!

Before using CMS Connect (JSON)

Before diving in, review these prerequisites so everything goes smoothly.

1. Enable CORS

CMS Connect uses Cross-Origin Resource Sharing (CORS) to access external public content on Salesforce side (CORS is not needed if the content you are pulling in is authenticated).

Make sure to add your Community host to the list of trusted hosts in the CORS header in your CMS system, if the JSON endpoint is not accessible to the Salesforce Communities domain.

For more information about CORS, check out this page.

2. Get the JSON URL

Identify the JSON URL for external content. Supported MIME media type is application/json.

For example, here’s how to get an endpoint from WordPress:

And here are some URL examples for different assets in WordPress:

CMS Connect (JSON) Configuration Step 1: Create a CMS connection

Before you can start pulling content into Lightning Community Builder, the first thing you need to do is to actually create and configure the CMS connection in Community Workspaces.

Go to Community Workspaces. Click CMS Connect. Click New to create a new CMS connection. For Name, enter a friendly name for the connection, for example, Capricorn WordPress. For CMS Source, enter the source, such as WordPress. Choose Other only

Working with Modular Development and Unlocked Packages: Part 2

This is the second installment in a series exploring how to begin working with your apps in modular pieces, incorporating packages into your app development lifecycle, and what packaging may mean for your team’s change management and release processes. Over the course of this series, we’ll talk about:

Part 1: What even is a package, anyway? How can you start to experiment with segmenting your org? Part 2: How can you start to organize metadata from an app, let alone an entire org, into packages? How do you tackle organizing your metadata and projects in source control? Part 3: What do these changes mean for app builder workflows? What will happen if I install an unlocked package into my production org today? Part 4: How can you define a successful Git branching strategy that works best for most team sizes? How, when and where should packaging be added to your continuous deployment?

In this post, we’ll look at getting your Salesforce DX project ready to work with multiple packages and segmenting an app into packageable modules. In the last post, we talked about what the shift to package-based delivery can offer teams and walked through extracting metadata from your org to begin migrating to a modular app dev model. If you haven’t read that post yet, it’s a good idea to go check it out and come back here when you’re caught up.

Approaching package construction using deployment dependencies

When I started to think about packaging and creating units for my packages, I started by thinking about deployment. Packaging is meant to make deploying easier, more standardized and repetitive. So I thought, why not look at creating smaller units of metadata (which may or may not turn in to packages) based on my most successful deployment habits?

I asked myself: What are the most common reasons my deployments have failed? Is there a pattern to the deployment order/release shapes I started relying on for my releases?

The resounding answer, to both questions, was dependency management. We talked about this a bit in our last post. Dependencies come in many forms, but managing the dependencies between metadata that cause bottlenecks during deployment seemed like a good place to start. So I decided to build layered packages, based on the dependency management patterns I’ve come to rely on during deployment.

Is this the only way to segment your org into packages? Absolutely not. But you’ll have to address the basic metadata dependencies that affect deployments (like the fact that any code or customizations that interact with custom objects or fields need those objects and fields to exist in order to deploy) no matter what organizing principle you choose.

Building a Salesforce DX project to support multiple packages

Instead of modifying anything about the Salesforce DX project containing my unmanaged package extract, I created a new and empty repository with the command sfdx force:project:create -n easy-spaces -p es-base. My initial sfdx-project.json looked like this:

{ “packageDirectories”: [ { “path”: “es-base”, “default”: true }

Salesforce for VS Code: Apex Replay Debugger and More

Salesforce Extensions for VS Code ships every week with bug fixes and updates. This post discusses a few of the major updates that have been released recently.

Apex Replay Debugger preview

You may have seen the exciting news at TrailheaDX that we are launching a log-based replay debugger as part of Salesforce Extensions for VS Code. Apex Replay Debugger brings Apex debugging to the Salesforce platform for everyone. The debugger is now available as a preview and is (and will always be) FREE for everyone to use. Finally, right?

Apex Replay Debugger makes it easier than ever to solve problems with your Apex code. Running the replay debugger gives you the same features you expect from other debuggers. You can view variables, set breakpoints, and hover over variables to see their current value. The replay debugger can be used from logs generated by running tests or for debugging interactive or non-interactive code and can be downloaded and run right from VS Code.

Apex Replay Debugger also makes it easy to work asynchronously and collaborate with others to solve problems. Because you can launch a replay debugger session from any replay-enabled log file, clients and coworkers can share logs to help solve problems. To start a debugging session simply open a log file and right-click to launch the debugger. For details, check out our docs in the Visual Studio Code Marketplace.

If you just want to jump in and start using Apex Replay Debugger, go download it now.

ISV Customer Debugger

For ISVs, debugging can be a pain. You are allowed to debug your code, your customer is allowed to debug their code, but sometimes you need to debug all the code in order to track down a problem. ISV Customer Debugger has existed for a while in the previous IDE, but now you can use the ISV debugger right from Visual Studio Code. For more information, see the “ISV Customer Debugger” section of the Apex Debugger documentation.

Apex syntax highlighting improvements

You may have noticed that your Apex code looks a little bit nicer. We have been working to improve syntax highlighting for Apex to properly colorize all elements and SOQL queries. We aren’t finished yet, but you should see some big improvements. We open sourced the official Apex Text Mate Grammar so that it can be used in other IDEs and, if so inclined, people can contribute pull requests. Additionally, the grammar is published as a node module. In both locations, you will find the grammar file in the TextMate XML format and the Atom CSON format.

Apex syntax highlighting in VS Code respects your theme as well, so if you want to make customizations to how your Apex looks you can easily do so. Below you can see how the Apex code now looks with the default VS Code dark theme.

Visual Studio Live Share

Finally, I wanted to point out a new feature that — while not exclusive for Salesforce developers — is a really

2.1 When standardcontroller is not sufficient

The Concept

Standardcontroller is awesome. However, in most cases, standard controller won’t be sufficient to cover our requirement. Think about the following situations:

When you need to bring up and fill in multiple object’s data. When you want to retrieve a list of records and bring them to the front page. When the user input data needs to be handled before they can actually be stored.

And many, many more.

Actually, if Visualforce can only work with standardcontroller, it won’t be that powerful at all.

Some Code to Demonstrate

Let’s create a page which displays Merchandise information at the top and user and create a transaction for that merchandise at the bottom.

Assuming you have created the Merchandise, Transaction and Customer SObjects. The details of Transaction and Customer SObject are at here.

Let’s create an Apex code controller called AddTransactionController with the following code:

public class AddTransactionController { public Merchandise__c curMer {get; set;} public Transaction__c curTrans {get; set;} public AddTransactionController(ApexPages.StandardController con) { String curMerId = con.getId(); curMer = [Select Id, Name, Original_Price__c, Discount_Type__c, Discounted_Price__c From Merchandise__c Where Id = :curMerId]; curTrans = new Transaction__c(); } public pageReference AddTransaction() { curTrans.Merchandise__c = curMer.Id; insert curTrans; PageReference pr = new PageReference(‘/’ + curTrans.Id); return pr; } }

And a Visualforce page called AddTransaction with the following code:

<apex:page standardController=”Merchandise__c” extensions=”AddTransactionController”> <apex:sectionHeader title=”Merchandise” subtitle=”Choose List”/> <apex:form > <apex:pageBlock title=”Merchandise”> <apex:pageBlockButtons > <apex:commandButton action=”{!AddTransaction}” value=”Add Transaction”/> <apex:commandButton action=”{!cancel}” value=”Cancel” immediate=”true”/> </apex:pageBlockButtons> <apex:pageBlockSection title=”Merchandise Info”> <apex:outputField value=”{!curMer.Name}”/> <apex:outputField value=”{!curMer.Original_Price__c}”/> <apex:outputField value=”{!curMer.Discount_Type__c}”/> <apex:outputField value=”{!curMer.Discounted_Price__c}”/> </apex:pageBlockSection> <apex:pageBlockSection title=”New Transaction”> <apex:inputField value=”{!curTrans.Amount__c }”/> <apex:inputField value=”{!curTrans.Customer__c }”/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

Save it and give it a try with an existing merchandise Id. For me, my url looks like this:

Replace it with your org instance name and merchandise Id.

Try to understand the code, but don’t try too hard. It is a bit tricky for now. So I will take a whole post to explain in the next post.

Next Post

2.2 Use apex to talk to database and persist data