Blog

Prior to the release of Lightning, Javascript buttons got users pretty far with their large variety of use cases. Today, in Lighting, however, Javascript buttons are a thing of the past. Below I am going to walk through several different use cases that, may have been previously handled with Javascript, using one of the Lightning ready ways.

Before we begin, here are the Use Cases and the tools in Lightning we will use to solve them.

Create a Contact from Account

    In this use case, we want a way to quickly create a Contact from the Account record we are on, and have some fields auto-populated.

    Step 1: Setup → Object Manager → Account → Buttons, Links, Actions → Select New Action

Step 2: Fill out the information as best you can. Select the fields you want the user to populate → Click Save

Step 3: Next, we are going to add the predefined fields, Account Name, and Phone

  • Click the New Button
  • Select the Object and the field you want
  • Use the Insert Field button to select the corresponding details
  • For Account Name, you will need to use Account ID


Step 4: Now we need to add it to the Page Layout, do this by going to the Layout you want it on and then select go the Mobile and Lightning Actions

Step 5: Add the button to the Salesforce Mobile and Lightning Experience section

Time to try it out!

Go to an Account and look for the button in the top right.

Click on the Quick Create button. On this page, you will see the fields we included and you will see the details that were auto-populated based on our settings:

Changing Status to Multiple Contacts

In this use case we are going to create a Lightning Action that uses a simple Visualforce Page. The action will be a button that we can put on the Related List so that we can adjust multiple records at once. Our goal is to be able to change the “Can Contact” status of multiple contacts on a single account. (The “Can Contact” field is a custom field set as a checkbox).

Step 1: Setup → Object Manager → Contact → Buttons, Links, Actions → Select Button or Link

Note: Prior to step 1 you would have needed to create a Visualforce Page for the Contact record. You can check out this trailhead for information on how to do that.

Step 2: Setup your Button like so:

Step 3: After saving the button, we need to add it to the layout. Go to the Account object and select the relevant Page Layout. Scroll to the Contacts related list and click the Wrench → Go to the Buttons section and add the Button you created.

Click Save and then let’s try it out!

Time to try it out!

Go to an Account and the look for the Contact related list (you should see the button there). Check the boxes of the Contacts you want to update and then click your new button.

On the next screen you will get the ability to adjust the records that you selected:

After you click save check out one of the Contact records to see if your update went through:

Open an External URL

Another functionality that you can do without Javascript is to open a record, an object, or an external URL. In this example, we will create a button that opens http://google.com/, however, in actuality, you may want to direct your users to an internal document or source. In addition to this example, you can also reference this page for other options.

Step 1: Setup → Object Manager → Contact → Buttons, Links, Actions → Select Button or Link

Step 2: Complete the page the like so:

Save it and then add it to your Contact page layout.

Time to try it out!

On the Contact record page, you should the button in the top right corner, based on the order you have your buttons.

Clicking on this takes me to google.com. If you find that you are missing the button and refreshing isn’t working, double-check that you have added not only the Button to the Page Layout but also the Mobile and Lightning Action version to the Salesforce Mobile and Lightning Experience section.

Those are just some of the different ways you can change your Javascript buttons to Lightning compatible actions. In addition to what was shown above, there are also Lightning Actions, often referred to as Lightning Components.

Lightning Components are building blocks that can be used to create tools that your users can use to do just about any action you can think of. The one challenge that comes with Lightning Components though, is that they do require code and development in order to get them setup. 

Salesforce has many resources, articles, and trailheads if this is something that you want to dive deeper into.

What Certification are you studying for now?

Focus on Force currently provides practice exams and study guides for sixteen certifications

Lightning Replacement to JavaScript Buttons

Prior to the release of Lightning, Javascript buttons got users pretty far with their large variety of use cases. Today, in Lighting, however, Javascript buttons are a thing of the past. Below I am going to walk through several different use cases that, may have been previously handled with Javascript, using one of the Lightning ready ways.Before we begin, here are the Use Cases and the tools in Lightning we… Read More

Focus on People: Mark Hilmer – Secret to Exams is Being ‘Fast and Curious’

Mark Hilmer built a consulting business out of the Salesforce knowledge he gained through the past 6 years. He specializes in helping medium-sized businesses to improve their customer service.Combined with hands on experience, he shares in this interview his strategic approach to preparing for the certifications. He thinks through which certification he needs to get, determines the right timing for his actual exam schedule and tells us his secret for… Read More

Top 10 Best Practices to Follow as a Salesforce Business Analyst

In the Salesforce hemisphere, there are many different roles one could hold. One of those roles is that of a Business Analyst. Though it can seem to be a confusing and vague title, it is a significant role in the successful delivery of any Salesforce project. Generally speaking, a Salesforce Business Analyst is someone who will help run a project from start to finish and will take on tasks like… Read More

Focus on People: Adam Schoolsky – From Employee to Consultant

Adam was a Salesforce user, then worked on Salesforce projects internally in his company and even worked for Salesforce itself. He quit Salesforce to fix motorcycles (which he loved) because he just couldn’t stand the pressure. Coming back to Salesforce after a few years, in a different environment – as a consultant outside of organizations, doing contract work and shifting gradually to the more advanced Developer side, he found a better,… Read More

Focus on People: Frederique Mermoz Mounier – Stay at Home Mom turned Salesforce Professional

Frédérique Mounier quit working for 4 years to be a stay-at-home-mom. When she decided to go back to work, she discovered Salesforce through a program directed specifically towards women wanting to get back into the workforce.Amidst a busy schedule (to keep up her thriving family life), she gained 4 certifications in her first 7 months of working on Salesforce. Read the story of how she achieved this superhuman (or should… Read More

Before and After a Salesforce Exam

With the study guides and the practice exams, we try our best to give you the most comprehensive view of what the exams might cover, to prepare you mentally for the exam. In this story, we give you a glimpse of what it might be like, psychologically and emotionally for actual people taking the exams. We have rounded up 3 participants in the last Australian Trailhead Bootcamp, who took their first… Read More

How to Stand Out as a Salesforce Developer

It isn’t news that the Salesforce ecosystem is growing. Last year, there were more than 5 acquisitions, 50 major enhancements and new features to the Salesforce multi-cloud, and the company itself issued revenue guidance of $13.23-13.24 billion. For those working in the ecosystem, this translated to a prediction that 3.3 million jobs would be created in the Salesforce economy by 2022. That works out at over one million jobs a year… Read More

Focus on People: Olivier Baelde – Advancing in Salesforce

“It’s a platform where you have to really keep current with what is new, what are the new things coming, and what features you can use in a particular project,” said Olivier in this interview for our Focus on Force community. Olivier Baelde is an experienced learner and user of Salesforce platform. He shares his thoughts about the platform and gives useful advice on how to keep moving forward in the Salesforce… Read More

Trailhead Takes It to the Beach

First Down UnderThe first Australian Trailhead Bootcamp was held from July 22 – July 25 at the Gold Coast in sunny Queensland. For people attending from the southern states of Australia, it was a welcome break from the cooler temperatures to the warmer blue skies of the sunshine state for 4 days of non-stop Salesforce learning! The Trailhead Bootcamp is unique in that it combines expert-led training, onsite help from instructors… Read More

Jumpstart for Non-profits

Salesforce has been solving an ever growing number of operational and technical problems for thousands of businesses all over the world. Much like it works for businesses, Non-profits can greatly benefit from using the platform. Salesforce recognized this, so they developed a system for the use of the Salesforce platform in the Not for Profit sector: The Non-Profit Success Pack (NPSP).Through the Salesforce Foundation, Salesforce donates 10 licenses for their… Read More

Focus on People: Richard Hone – Midlife Career Change Towards Salesforce

In today’s interview, we have Richard Hone, a Salesforce learner who is working with a Nonprofit Success Pack partner.  From an electrical engineer with more than 20 years experience, he is now a successful Salesforce developer. He shared that exploring Salesforce for Nonprofit is one of the biggest decisions he made midlife. He went into detail as to how he prepared for his certification: going through the study guides, practice… Read More

Common Pitfall Errors as a Result of “Order of Execution”

When building in Salesforce, it is essential to keep in mind the order of execution of the different components that make up a Salesforce build. These components consist of almost anything you can think of, from Point-and-Click to well-written code. In the image below, you can see the order of operations that Salesforce follows when taking such components into account.An example of a basic order of operations can be: first… Read More

Focus on People: Dominick DeFazio – From Sales to Lead Dev

Dominick was in sales when he started his Salesforce journey. As a user, he was frustrated with how the org was set up for the functions that he would use everyday. Determined to improve their team’s processes, he tried to learn Salesforce configuration and went straight to pursuing a PD1 Certification.Read about his insights and tips to help others achieve a rapid on-the-job learning of Salesforce that enabled him to… Read More

Focus on People: Nat Sullivan – From Start by Accident to Start with Confidence

Nat had never heard of Salesforce when she was offered an internal position by her company to be the Salesforce Trainer for North America. Coming from an end-user non-technical background, it felt like she was pushed into deep waters, and forced to swim.  Read how her Salesforce journey has led her to the most challenging, yet the most rewarding experiences of her life. In this interview, she tells us about the… Read More