How To Make A Lightning Link
I want to add a link to the contact in the contact name Can anyone tell me how to do that? I am very new to lightning and any help would be appreciated. Lightning-aura-components contact aura Share. Improve this question. Follow edited Jul 5 '16 at 12:07. E.force:XXX event is handled by the one.app container. It’s supported in Lightning Experience and Salesforce1 only. If used outside of Lightning Experience or Salesforce1, this event won’t be handled automatically. To use this event outside of one.app, create and wire up an event handler of your own. In an AR you can easily make it work in a safe/semi/auto setup by using a m16 selector and grinding the selector a little flat on the safe position then cutting a notch in the disconnector where the link hits in that position. Then in auto it grabs the disconnector again. I think it is a simple and safe design. The Ligtning Machine. Insulating fiberglass launch supports. Electronics box for measuring current. Uman’s team has found that lightning isn’t powerful enough to. When I click on the Email link in the Activity History Related List. It launches the “Email Report” quick action but the To field isn’t populated. When I changed the Default Activities View to the Activity Timeline view, I get a standard Email tab and a tab for my Email Report quick action. When I create an email here, the To field populates.
Learning Objectives
After completing this unit, you’ll be able to:- Add components to a Lightning page
- Configure the properties of a Lightning page and a Lightning component
- Add actions to a Lightning page
- Add a Lightning page to Lightning Experience and the mobile app
The App Home Lightning Page
Create an App Page
Let’s build an app home page for a sales team.
Your sales team needs to see top deals in the pipeline, with a visual interface that makes it easy to absorb key details at a glance. They want to see the most recent opportunities they’ve viewed and be able to drill into the record details with a single tap or click. And they want functionality to log calls and create accounts and opportunities on the go.
Let’s get started!
- From Setup, enter
App Builder
in the Quick Find box, then select Lightning App Builder. - Click New.
- Select App Page, and then click Next.
- Name your Lightning page
Top Accounts and Opportunities
. - Select the Two Regions template, and click Finish.
If the Lightning App Builder walkthrough pops up, dismiss it. - Drag the List View component into the first region.
- In the properties pane, under Filter, select Account for the object, select the Platinum and Gold SLA Customers filter, and set the number of records to display to 5.
- Add a Recent Items component into the second region.
- In the properties pane for the Recent Items component, click Select and add the Opportunity object to it.
- In the properties pane, click Page, click Select, and then add these actions to the page.
- Log a Call
- New Account
- New Opportunity
You can add only global actions to a Lightning app page.
- From the toolbar, change the view to Tablet-Landscape.
- Click Save, and then Not Yet.
Now that you’ve created your page, you’re almost ready to add it to Lightning Experience and the mobile app.
Add Your App Page to Lightning Experience and the Salesforce Mobile App
Just like the other pages, your users can’t access your app page until you activate it. During activation, you can customize the page’s custom tab label, adjust its visibility, and set its position in the Salesforce mobile app and Lightning Experience app navigation bars, all in one place.
- Click Activation.
- Don’t change the app name. By default, the label that you give the Lightning page is used as the label for its custom tab.
- Change the icon to the blue lightning bolt icon. The icon that you choose here is used as the icon for the page in the mobile app and in Lightning Experience.
- Keep the tab’s visibility open to all users.
The Activate for the System Administrators only setting is useful while you’re working on your Lightning page. Restricting your page to administrators only means that you can see and test the page, but your users can’t see it until you’re ready to expose it to them. - Click the Lightning Experience tab.
- Select the Sales app, and click Add page to app. The page you’re adding to the menu appears in the second position by default. Let’s leave it there. If you put it into the top position, it becomes the landing page for all your Lightning Experience users.
- Click the Mobile Navigation tab.
- Select Mobile Navigation Menu, and click Add page to app.
This adds the app page to the mobile navigation in the “Mobile Only” Lightning app in the Salesforce mobile app. Adding the page to the Sales app in Lightning Experience like we did previously, ensures that the app page appears in the Sales app within the Salesforce mobile app as well.
By default, new pages you add to the navigation in the “Mobile Only” app appear below the Smart Search Items menu item. If you leave the Top Accounts and Opportunities page there, it will appear in the Apps section of the menu. We don’t want that, so let’s move it up. - Drag the page to below the Today menu item.
- Click Save.
Test Your App Page in Lightning Experience
You’ve created your page and activated it. Now let’s see it in action!
- If you’re still in the App Builder, click Back to return to Setup.
- From the App Launcher ( ), find and select Sales.
- Click Top Accounts and Opportunities from the app navigation bar.
Here’s your Lightning page! The lightning bolt icon appears here too, and the three actions that you added are in the highlights panel.
Test Your App Page in the Salesforce Mobile App
- Open the Salesforce mobile app.
- Log in using your Trailhead Playground credentials. (If you don’t know your Trailhead Playground credentials, see this article.
- From the menu, tap the App Launcher, and open the Sales app.
You might have to pull and refresh the Sales app menu to see the changes. - Tap Top Accounts and Opportunities.
Here’s your Lightning page! It has the lightning bolt icon you chose, and the three actions that you added are in the action bar. - Play around with your page. Scroll up and down to see the components, and tap an action icon to see what happens.
Resources
The topic of disabling links popped up at my work the other day. Somehow, a “disabled” anchor style was added to our typography styles last year when I wasn’t looking. There is a problem though: there is no real way to disable an <a>
link (with a valid href
attribute) in HTML. Not to mention, why would you even want to? Links are the basis of the web.
At a certain point, it looked like my co-workers were not going to accept this fact, so I started thinking of how this could be accomplished. Knowing that it would take a lot, I wanted to prove that it was not worth the effort and code to support such an unconventional interaction, but I feared that by showing it could be done they would ignore all my warnings and just use my example as proof that it was OK. This hasn’t quite shaken out for me yet, but I figured we could go through my research.
First, things first:
Just don’t do it.
A disabled link is not a link, it’s just text. You need to rethink your design if it calls for disabling a link.
Bootstrap has examples of applying the .disabled
class to anchor tags, and I hate them for it. At least they mention that the class only provides a disabled style, but this is misleading. You need to do more than just make a link look disabled if you really want to disable it.
Surefire way: remove the href
Lightning Link Blueprints
If you have decided that you are going to ignore my warning and proceed with disabling a link, then removing the href
attribute is the best way I know how.
Straight from the official Hyperlink spec:
The href
attribute on a
and area
elements is not required; when those elements do not have href
attributes they do not create hyperlinks.
An easier to understand definition from MDN:
This attribute may be omitted (as of HTML5) to create a placeholder link. A placeholder link resembles a traditional hyperlink, but does not lead anywhere.
Here is basic JavaScript code to set and remove the href
attribute:
Styling this via CSS is also pretty straightforward:
That’s all you need to do!
What Is An Auto Sear
That’s not enough, I want something more complex so that I can look smarter!
If you just absolutely have to over-engineer some extreme solution, here are some things to consider. Hopefully, you will take heed and recognize that what I am about to show you is not worth the effort.
First, we need to style our link so that it looks disabled.
Setting color
to currentColor
should reset the font color back to your normal, non-link text color. I am also setting the mouse cursor to not-allowed
to display a nice indicator on hover that the normal action is not allowed. Already, we have left out non-mouse users that can’t hover, mainly touch and keyboard, so they won’t get this indication. Next the opacity is cut to half. According to WCAG, disabled elements do not need to meet color contrast guidelines. I think this is very risky since it’s basically plain text at this point, and dropping the opacity in half would make it very hard to read for users with low-vision, another reason I hate this. Lastly, the text decoration underline is removed as this is usually the best indicator something is a link. Now this looks like a disabled link!
But it’s not really disabled! A user can still click/tap on this link. I hear you screaming about pointer-events
.
Ok, we are done! Disabled link accomplished! Except, it’s only really disabled for mouse users clicking and touch users tapping. What about browsers that don’t support pointer-events
? According to caniuse, this is not supported for Opera Mini and IE<11. IE11 and Edge actually don't support pointer-events
unless display
is set to block
or inline-block
. Also, setting pointer-events
to none
overwrites our nice not-allowed
cursor, so now mouse users will not get that additional visual indication that the link is disabled. This is already starting to fall apart. Now we have to change our markup and CSS…
Wrapping the link in a <
span
>
and adding the isDisabled
class gives us half of our disabled visual style. A nice side-affect here is that the disabled class is now generic and can be used on other elements, like buttons and form elements. The actual anchor tag now has the pointer-events
and text-decoration
set to none
.
What about keyboard users? Keyboard users will use the ENTER
key to activate links. pointer-events
are only for pointers, there is no keyboard-events. We also need to prevent activation for older browsers that don’t support pointer-events
. Now we have to introduce some JavaScript.
Bring in the JavaScript
Now our link looks disabled and does not respond to activation via clicks, taps, and the ENTER
key. But we are still not done! Screen reader users have no way of knowing that this link is disabled. We need to describe this link as being disabled. The disabled
attribute is not valid on links, but we can use aria-disabled='true'
.
Now I am going to take this opportunity to style the link based on the aria-disabled
attribute. I like using ARIA attributes as hooks for CSS because having improperly styled elements is an indicator that important accessibility is missing.
Now our links look disabled, act disabled, and are described as disabled.
Unfortunately, even though the link is described as disabled, some screen readers (JAWS) will still announce this as clickable. It does that for any element that has a click listener. This is because of developer tendency to make non-interactive elements like div
and span
as pseudo-interactive elements with a simple listener. Nothing we can do about that here. Everything we have done to remove any indication that this is a link is foiled by the assistive technology we were trying to fool, ironically because we have tried to fool it before.
But what if we moved the listener to the body?
Are we done? Well, not really. At some point we will need to enable these links so we need to add additional code that will toggle this state/behavior.
That’s it. We now have a disabled link that is visually, functionally, and semantically disabled for all users. It only took 10 lines of CSS, 15 lines of JavaScript (including 1 listener on the body), and 2 HTML elements.
Seriously folks, just don’t do it.