Using Lightning Components In Visualforce page

In this blog, I am going to explain how to invoke the lightning component from the visualforce page by using Lightning out. Add Lightning components to your Visualforce pages to combine features you’ve built using both solutions. Implement new functionality using Lightning components and then use it with existing Visualforce pages. Lightning Components for Visualforce is based on Lightning Out, a powerful and flexible feature that lets you embed Lightning components into almost any web page.

Step 1: Create Sample Component

Create a lightning component with below code which contains two attributes

Step 2: Create  Lightning Dependency App

To use Lightning Components for Visualforce, define component dependencies by referencing a Lightning dependency app. This app is globally accessible and extends ltng:outApp. The app declares dependencies on any Lightning definitions (like components) that it uses.

Step 3: Using in Visualforce from the page

There are three steps to add Lightning components to a Visualforce page.

  1. Add the Lightning Components for Visualforce JavaScript library to your Visualforce page using the <apex:includeLightning/>  component.
  2. To reference this app on your page, use the following JavaScript code.
  3. Finally, add your top-level component to a page using $Lightning.createComponent(String type, Object attributes, String locator, function callback). This function is similar to $A.createComponent(), but includes an additional parameter, domLocator, which specifies the DOM element where you want the component inserted.

Here is the final code.

 

 

Continuation Chaining Asynchronous Callouts

If the order of the callouts matters, or when a callout is conditional on the response of another callout, you can chain callout requests. Chaining callouts mean that the next callout is made only after the response of the previous callout returns. You can chain up to three callouts.The following Visualforce and Apex examples show how to chain one callout to another.

 

 

Visualforce Page Actions

Introduction

In this blog post, I am going to explain how to set up global actions and object-specific actions by using visualforce page.The global action which we are going to see in this blog is to send the message to slack channel and object specific action is to take the case ownership from the assigned queues.

Global Actions:-

As we are going to going to post the message to slack by using the global action, go and create a Slack app and get the slack token. Please refer this link

visualforce page is here below

 

And the controller is here.

Go to set up, find global actions and create a new one as shown below.

Add to the publisher layout as shown below.

After saving the publishers layout you can able to see the quick actions as shown below.

Object Specific actions

Now I am going to walk thru how to create the object specific action.To associate an action to object you need to user standardController attribute of the object. Here we are going to create a Case Quick actions which are allowing the user to take the ownership of the case from case queue.

Here is the visual force page

The controller is here below.

Both in global action and Object actions, I set showQuickActionVfHeader to false. So that we will not able to see the Standard Submit and Cancel Global action header.

Now go to Case Object buttons and links and create a new action as shown below

Add the object to quick action, salesforce 1 and lightning action on page layout based on whether you wanted to show on salesforce class or salesforce 1 as shown below.

 

Publisher Events

Refresh feed (desktop) 

Submit hook (Salesforce1)

Close publisher event

Activate publish button 

Clear Panel State

Show Panel State 

Success State 

 

Redirect (Salesforce1)

 

Salesforce Chatter Profile Tabs

Introduction

In this blog, I am going to explain how to customize the Chatter profile pages by using subtab apps.An app is a group of tabs that work as a unit to provide application functionality. Similarly, a subtab app is a collection of tabs that appear on the Chatter profile page. A subtab app can include both default and custom tabs. Users can see different sets of tabs on the profile page depending on their context. Subtab apps are the various sets of tabs available on specific pages, such as users’ profile pages.These default subtab apps determine which tabs display, depending on the user’s context.

Profile (Others) Subtab App Displayed to the user when viewing…
Profile (Self) Their own profile inside their internal organization
Profile in Communities (Others) Another user while inside a community. It’s shown only if Communities is enabled.
Profile in Communities (Self) Their own profile inside a community. It’s shown only if Communities is enabled.

What is a Profile Tab?

A profile tab is a custom tab you create to display custom object data or other web content on the profile page.You can use   Custom web tabs display any external web-based application or web page or  Visualforce tabs display data from a Visualforce page.

Customize Chatter Profile Pages

Now what we are going to do is simple visualforce page wich contacts hard-coded information about past five days stock prices. Here is the sample code for the same.

  1. Now Create the tab for the above visualforce page.
  2. From Setup, enter Apps in the Quick Find box, then select Apps to display your organization’s subtab apps.
  3. Edit the app and include the Stock Price page which we create
  4. Now if you can go your chatter profile page you can see the details as shown below in the chatter profile.

 

 

 

 

Sales force Platform Encryption API – APEX

In this blog, I am going to explain how to use the TenantSecret object in salesforce to generate the tenant secret key for Platform encryption.

We are going to build the visualforce page that used to create tenant secret key and view all the existing tenant secret key. Visualforce page looks as shown below

The Page controller is shown below

controller

 

Visual force page is shown below.

 

Github URL for the code:-
https://github.com/rajamohanvakati/Platform-Encryption-