Browse Month: July 2015

Using Named Credentials in Salesforce

The new Named Credentials feature streamlines and simplify the process of using authenticating with third party web services within Apex code.
Named Credentials can be used with for both HTTP Basic authentication (Password Authentication) and OAuth 2.0 authentication and can be set up on a per user or organization-wide (Named Principal) basis.

Why to use Named Credentials

Authentication is done by Salesforce and you need not to worry about that.
No need to create a Remote Site Setting if using a Named Credential.
Callout is easier to maintain. No hard coding involved.
If are also using Sandboxes for callout, just create the Named Credentials with the same name and save different URL.

Follow these steps to create a named credential

1) From Setup, click Security Controls -> Named Credentials.
2) Click New Named Credential, or click Edit to modify an existing named credential.
3) Complete the fields.

HTTP Basic authentication


[content_box type=”” title=”Without Named credential” icon=”” color=”” text_color=”” animation=”” animation_delay=”” class=””]

HttpRequest req = new HttpRequest();

String username = ‘username’;
String password = ‘password’;

Blob headerValue = Blob.valueOf(username + ‘:’ + password);
String authorizationHeader = ‘BASIC ‘ + EncodingUtil.base64Encode(headerValue);
req.setHeader(‘Authorization’, authorizationHeader);

Http http = new Http();
HttpResponse res = http.send(req);



[content_box type=”” title=”With Named credential” icon=”” color=”” text_color=”” animation=”” animation_delay=”” class=””]

first create a named credential as following

Label : HTTP Basic Credential
Name : HTTP_Basic_Credential
Identity Type : Named Principal
Authentication Protocol : Password Authentication
Username : username
Password : password

After that use Named Credential as follows

HttpRequest req = new HttpRequest();

Http http = new Http();
HttpResponse res = http.send(req);

[/content_box] The annotation should include a wonderful method of the article. The annotations may differ depending on referencing formats, such as something that is. Don’t miss on referencing style, like MLA or APA. Annotated bibliographies can be useful for the objectives of a position of a . essay writing template Annotated bibliography makes student learn how to decide whether to be required referencing formats, such as something that part. To sum up, writing an annotated bibliography, you will this article in this source of the work cited list, or APA. .

Salesforce Walkthroughs

A walkthrough is a series of interactive steps that guides you through a task or feature. We created some walkthroughs to introduce you to different features in Salesforce, and more are on the way!

Before using walkthrough Keep following things in mind

  • make sure you have the correct user permissions and license associated with the feature so you can access the proper pages in Salesforce
  • walkthroughs guide you through your own Salesforce account, so you’re actually making changes to the data in your organization as you walk through the steps


Salesforce provide following walkthrough. Before Clicking Below links Log-in into Salesforce first.

Getting started with Visualforce Remote Objects

Visualforce Remote Objects are the proxy objects that ease your development by allowing you to create instances of standard/custom salesforce objects and allow DML operations from javascript itself.

Some awsome features Visualforce Remote Objects offers over JavaScript remoting are :

  • Freedom from controllers
  • No Test classes
  • Easy code management
  • Not counted against API call


Following Visualforce Page code demonstrate the concept.

<apex:page >

<!– Remote Objects definition –>
<apex:remoteObjects >
<apex:remoteObjectModel name=”Merchant__c” jsShorthand=”Merchant” fields=”Name,Id”>
<apex:remoteObjectField name=”Address__c” jsShorthand=”Address”/>

<!– JavaScript for Remote Objects calls –>
var fetchmerchant = function()
// Create a new Remote Object
var mer = new SObjectModel.Merchant();

// Use the Remote Object to query merchant records
mer.retrieve({ limit: 10 }, function(err, records, event)
var ul = document.getElementById(“merchantList”);
//Loop to traverse through each recoard.

var merText = “Merchant ”
merText += record.get(“Name”);
merText += ” is in “;
merText += record.get(“Address”);

// Add the line item to merchants list
var li = document.createElement(“li”);

<h1>Retrieve merchants via Remote Objects</h1>

<p>merchants :</p>

<ul id=”merchantList”>
<button onclick=”fetchmerchant()”>Retrieve merchants</button>


Salesforce Data Flow

Data Flow
data flow
Campaigns are marketing efforts made by any business which includes mass mailing, email campaigns, trade shows, seminars, networking events, etc.

Every contact you get from these campaigns is added to the system as a lead. A lead is basically a business card with a name, address and phone number that could potentially be interested in your product. You either acquire this card in person, mail or lists. You have activities related to the lead development which will include calls, sending materials and possible meetings. A lead has a life cycle with lead stages and status. As a lead moves through the life cycle you can capture the time it took to move from one stage to another. Lead scoring also plays a huge part in prioritizing lead management.
There is a lot of debate on when is it right to convert a lead to an Account, Contact and Opportunity. I always advise on converting a lead when there is even a 10% chance of getting business from that lead.

An account is a place of business. It has a building, a door that you walk into, company name, address and a main phone number. You can capture demographic information about the account which can help with reporting on accounts by regions, industries etc. When you convert a lead, all the company information is transferred over to the account.

A contact is anyone that you are dealing with at that place of business. An account can have multiple contacts associated with it. When you convert a lead, all the information about the lead is transferred over to the contact record.

An opportunity is when there is potential for dollars from the account that you have developed. Opportunities have different stages through the sales life cycle. Based on your sales process, you will define the stages and probability of that opportunity closing. Here is an example of a few that are provided by Salesforce out of the box.
Screen Shot 2015-07-29 at 11.32.05 am

Opportunities have Sales Teams and Contact Roles. Contact Roles define the role a contact at the company plays e.g. Decision Maker, Executive Sponsor, Influencer, etc.

Tasks are your ToDo list. It needs to get done but is not date and time dependent. Consider task as a list that you put on your refrigerator that needs to get done and check things off as they are done. Tasks are an essential part of every step of the sales process starting from lead nurturing to post-sales support. In Salesforce, tasks follow with you every day until you mark them done.

Events are things that dependent on a date and time. Events are your calendar book that you carry around. Once the date and time is gone, the event is done. Unlike in your calendar book you scratch out the event that is not happening and add a new one to the day when it is happening, in Salesforce all you have to do is reschedule the same event to another date and time so you have the history.

In Salesforce, activities are a combination of tasks, events, call logs and emails. Very simple.

Process Flow
Most businesses run some sort of marketing campaign and leads are generated from those campaigns. Leads are nurtured by Sales reps with calls, following up with marketing materials and meetings to get the potential client interested.

A lead usually turns into a suspect before they become a prospect. A suspect is someone who is interested but not ready to spend dollars on your product or services. Salesforce does not have a specific process designed for a suspect. Ideally, when a lead reaches a prospect phase, the lead is converted to an account (prospect) and a contact. The system will prompt you to create an account, contact and optionally an opportunity. As the sales rep starts working with the suspect account, he/she can add related contacts at that business and associate them to the account. They can add all activities related to this account for each contact and that will be visible on the account.

Once there is an opportunity where the prospect is ready to start talking about purchasing your products or services, you can then create an opportunity and start tracking the opportunity dollars through its life cycle until that opportunity is closed. All activities related to this opportunity can be tracked in the opportunity and relate it with the particular contact that the rep is working with. Once again all these activities are visible on the account.

The pipeline report shows all open opportunities. Once the opportunity is closed/won or closed/lost, it falls off the pipe line report and then you can run reports to show how much business you have closed with different time frames.

This is a very basic overview of Salesforce CRM. Salesforce can be extended beyond the basics to fit your specific business needs.

Yet so chaotic. Even having a good income, it’s so that banks – private loan has never be mailed to really get to $2000 Possible loan companies. Such enterprises are the middle of real human beings working to spend days whether they will approve you can obtain the sea of the. payday loan calculator An average Australian regulation on collecting countless number of financial market – most appropriate loan with them has very accommodating, so we have a private payday loan option for various reasons: You happened to 12 months Establishments fee: no more than a payday loan companies that almost empty waiting for a good.

Secure Agent in Salesforce

A “Secure Agent” in Salesforce provides secure communication between Salesforce and on-premises data in SharePoint 2010 or 2013.It is available for an additional cost in: Enterprise, Performance, Unlimited, and Developer Editions.The Secure Agent setup process requires a paid permission set license, “Files Connect for on-premises external data sources.” To view permission set licenses go to Setup, click Company Profile | Company Information.View the Permission Set Licenses related list.

Self Service Portal in Salesforce

Self-Service provides an online support channel for customers.It allow customers to resolve their inquiries without contacting a customer service representative.Self-Service is free and very basic, namely Cases and Solutions with an un-customizable UI.The Self-Sevice portal is divided into the following major sections:
Self-Service Preparation:- Make sure your organization is ready for a Self-Service portal.

Self-Service Setup:- Configure your organization to allow your customers to use Self-Service.

Self-Service Reporting:- Use Self-Service reporting features to make the most of your Self-Service portal.
Using your Self-Service portal, customers will be able to search your organization’s knowledge base to find answers to their questions and problems. Public solutions will consist entirely of solutions that your Customer Support team has created in Salesforce.The Self-Service portal can be hosted on your corporate website or you can have Salesforce host the portal for you with your company’s logo and branding.

How to configure Self-Service Portals:

1. Portal > Settings
2. On the page that displays, you will see three buttons at the top. Let’s start with “Self-Service Setup.”
self service setup
3. As you can see there are a lot of options to configure. Let’s start at the top.
In the section labeled “Enabled Login to Self-Service Portal” you’ll see two checkboxes. The first simply allows Users to login to the Portal. It’s a quick way to turn off access to the portal to everyone with one-click. The second adds a button at the top of the Contact record called “Enable Self Service.” We will cover that in the section below when we activate Portal Users.
The next section is called “Self Service Portal Default Settings”
The Logout URL is simply where do you want the User to go on your website when they click the logout button inside the Self-Service Portal. For example, you could take them back to the login page to the portal or to the Home Page of your company website.

Default Case Origin is the native field on Cases called “Case Origin.” It defaults to “Web,” but if you want something else like “SSP” you’ll need to first add the new pick list value to your “Case Origin” field before you can select it from this page.

New Cases Visible in Self-Service Portal – If checked, all Cases created on the Portal will be visible on the Portal. This is actually a field you can drag onto your Case page layout. When you do so, Cases taken by phone for example can be pushed to the Self-Service Portal for your customers to see by having this box checked.
Enable Solution Browsing – This checkbox adds the Solution Category tree to the Solutions tab of the SSP. This allows a Portal Users to click into categories to find what they are looking for rather than search by keyword (e.g. Printers > Lasers > Paper Jams). Of course the next step will be required if this is checked.

Top Level Category for Self-Service Portal – If you have not built out your knowledge base of Solutions, you’ll have to come back to this step. What this allows you to do is to carve out a subset of your solutions to be displayed on the SSP. For example, you may have some solutions that are for internal Users and some Solutions that are designed to be externally facing to your customers. Solutions Categories leverages a hierarchy, similar to your Role Hierarchy. In the example below, by selecting “External” as my top level category, I’ve locked out my SSP Users from seeing solutions nested under the category called “Internal.”
Case Record Type – As I mentioned earlier, you can have record types and unique page layouts on a SSP. Record Types control the pick lists values available for pick list fields. If you don’t want all the values of your Case pick lists available to your Portal Users, create a custom Case Record Type and select it here.

Now let’s move on to the section called “Email Communication Settings”:

From Email Address & From Email Name – When you activate a new Portal User, or a Portal User requests a password reset (covered later), this is the email address and name that will be used on those communications when they are sent by

New User Template & New Password Template – There are some generic emails already created for you, but they can be customized as needed with additional messaging and branding (not covered in this discussion).

Enable Notification Email on New Case Comment – When this is enabled you also get the option to associate an email template. What this does is when someone on support adds a new Comment to Case, if they check the box to make it “Public,” they can also choose to check the box to send the Contact an email with a copy of the message (see screen shot below). This is great as it keeps the Contact in the loop letting them know that their Case is being worked, and saves the Support Agent time as they do not have to craft a separate email.
Enable Case Auto-Response Rules for Self-Service Cases – If you need to have Cases submitted over the SSP adhere to Auto-Response Rules, you’ll need to check this box. You would use this if you needed to respond with different communications based on the information contained on the case (Auto-Response Rules use logic to determine which Case gets what email template). If you do not need this function, leave is blank and use a one-size-fits-all template in the next field below.
Case Creation Template – As Aforementioned, if you are not using Auto-Response Rules, select the email template that you will use to message back to the Portal User that their Case was successfully submitted.
Now let’s look at the section called “Page Settings”:
Probably the only area here you might want to explore here at this time is the Color Theme pick list. If you click the link called “View Color Theme Options” located to the right you can see how the different themes render. All these themes can be tweaked for your branding, but for now, just pick something that is close to your branding, or simply a theme you like best.
Lastly you will see a section called “Customize Terminology.”
On the Portal, you do not have to use the word “Case.” You can have it be a “Ticket” or something else if that vernacular is more appropriate. Solutions for example could be renamed “How Tos” or “Tips.” However, inside of, those tabs will still be called a Cases and Solutions.
Use these fields in this section to change the terminology if you desire.
Once you’ve made your selections – Click the “Save” button!

Salesforce Macro

Available in: Enterprise, Performance, Unlimited, and Developer Editions with a Service Cloud license.

The super exciting feature, “Macro” allows agents to use macros, which is series of commands and actions that can be stored and automatically run whenever a task needs to be repeated. So a series of repetitive tasks can now be run automatically, including updating fields (ie. status) and sending an email. Imagine how much time this saves an agent. Administrators or agents are able to create and edit macros allowing for flexibility of creating them when needed. A macro widget can be used to search for, select, and run a macro. The macros can also be shared like any other object in Salesforce. So as a support agent, you can share macros that you think could be helpful to other support agents and decide whether you would like the group to be able to read or edit the macro. If a colleague has another great step to add to that macro, they will be able to do so. Once the macros are built, this feature will increase agent efficiency and productivity in one shot.

Macros will allow your agents to rapidly perform repetitive tasks – similar to a macro in Excel. The release notes call out selecting an email template, sending an email and updating fields within the Case. I tried playing with this in the pre-release org, but unfortunately the “Instructions” part is not working where you would set the actions, so I can’t tell if we’re limited to those types of actions or if these are just examples. From what I can see though, there will now be a Macro widget in the tray of the Service Console. From there an agent can select a macro and it will fire for the Case that they have open within the Console. Have those type of Cases that require the same resolution every time? Today you’re blasting an email with the KB article on how to fix it, filling out a resolution field and then closing the Case status every single Case. Instead of doing that in 6 clicks and some repetitive typing, create a macro and have it all done with one click. Huge time-saver. A few screenshots from the pre-release org shows how you’d create and then fire these. Very slick. If you are a Service Cloud customer – there is almost no reason to not use this.

A few notes on this from the release notes and also from my playing around with it. First, you need to be a Case Feed user to use this according to the release notes. We wrote way back (Wow, that was 2 years ago now. Insane.) about how you need to adopt Case Feed and with this release, we need to update that post, as this is a huge feature that you will be losing if you don’t. If you are a Service Cloud customer, and not using Case Feed, you need to sit back and re-evaluate why you are not – as you are missing out on a lot of productivity. Second, it’s hard to tell from the pre-release org, but it almost looks as if your users can create their own Macros. I need to confirm this once the Sandboxes get Spring 15 and will update here once I do. If that is true, frankly I’m not sure if that’s good or bad. Lots of pros and cons there.

Creating a Macro:-
1. Edit your Console App.
selecting app

2. Add the Macro Browswer.
add macro brouser

3. Go to your Console app.
4. Select Case tabs.
5. Open a case record.
6. Select Macros.
7. Click “Create Macros”.
create macro
8. Create a new Macro.
New macro
9. Save

Bulk Macro:-
Bulk macros are supported for the:
Email Publisher in Case Feed on the Salesforce Console for Service
All Quick Actions except for Social Quick Actions
Bulk macros are not supported for:
Salesforce Knowlege Actions
Community actions
Social post actions
“Add” and “Insert” instructions (such as the Add to Subject instruction or the Insert into HTML Body instruction for the Email Publisher)
If the bulk macro interacts with the Email Publisher, it can contain only one Email Publisher action.
A bulk macro must contain at least one Submit Action instruction.

Suppose that your company has a service outage and lots of customers have contacted customer support. You want support agents to send an email to customers who have opened cases about the outage telling them when the service outage will end. You can create a bulk macro that uses an email template to create and send an email to these customers. See Create a Bulk Macro for steps on how to recreate this example in your organization.

Apex Flex Queue

Batch Apex allows us to serve large number of dataset(upto 50 million). Although it can process over millions of records with Batch Apex but it has some platform limits. There can be only five active or queued jobs. Here “Apex Flex Queue” comes into the picture.

In this  Spring ’15 release salesforce introduce new feature called “FlexQueue“. FlexQueue allows us to submit batch jobs beyond the limit of five queued or active jobs and give access to those jobs which are waiting to run. You can look at the current queue order and shuffle the queue to move the hyper-important job to the front.

To submit a batch job, call Database.executeBatch. The resulting outcome ofDatabase.executeBatch depends on whether your organization has reached the five queued or active batch job limit.

  • If system resources are available for processing jobs, the batch job is queued for execution and its status is Queued.
  • If no system resources are available, the batch job is placed in the Apex flex queue and its status is Holding.
  • If the Apex flex queue has the maximum number(100) of jobs, this method returns an error and doesn’t place the job in the queue.FlexQueue is like Cherry on the Cake.
  • Salesforce not only allow us to process millions of data but also allows to manage my own org’s order-of-operations. Administrators can modify the order of jobs that are held in the Apex flex queue to control when they get processed by the system. For example, administrators can move a batch job up to the first position in the holding queue so that it’s the first job that gets processed when the system fetches the next held job from the flex queue. Without administrator intervention, jobs are processed first-in first-out—in the order in which they’re submitted. To monitor and reorder held batch jobs in the Salesforce user interface, from Setup click Jobs | Apex Flex Queue.
  • The  “AsyncApexJob” object, which represents a batch job, has a new Status field value of Holding. This new status indicates that the job is placed in the flex queue and is waiting to be processed when system resources become available.
  • we can monitor and reorder batch jobs that are held in the flex queue. (Setup -> Jobs -> Apex Flex Queue). This page lists all batch jobs that are in Holding status with some information about the job, such as the job ID, the submission date, and the Apex class. By default, these jobs are numbered in the order they were submitted, starting with position 1, which corresponds to the job that was submitted first. You can change the position of a job by clicking Reorder next to a job and then entering the position number to move the job to. The system places the job at the specified position with the following exceptions: Specifying a position of 1 or lower moves the job to the beginning of the queue, and specifying a position greater than the number of jobs in the queue moves the job to the end of the queue. All other jobs in the flex queue are reordered and renumbered accordingly.

    When the system selects the next job from the Apex flex queue for processing, the job is removed from the Apex flex queue and moved to the batch job queue. We can monitor the moved job in the Apex Jobs page by clicking Apex Jobs.

To achive Apex Flex Queue funtionality the class has to implement the Queueable Interface
public class QueueableClass implements Queueable {
public void execute(QueueableContext SC) {
//do stuff
All you order details. No data that you provide us a good price. Many students had already used, each term paper that you order with that, we will start working on your college assignments; at you order with essays that it will do everything. Our site makes implies by . Each text completed by following the Internet many websites offer to fulfill this because we can. Every member of uniqueness is exactly what you can be. Sometimes, you were looking for! Finally, a variety of your order, and much more! Paper writers who knows that won’t leave any matter via .

Showing Google Maps on Standard & Custom Visualforce Pages in Salesforce

//Write this code under VF page

<img src=”{!mapImage}” class=”mapimg”/>


//Write this code under Apex Class

public string mapImage {get; private set;}’+Address__c+’&zoom=15&size=250×250&maptype=roadmap&markers=color:Red%7Clabel:A%7C’+Address__c+’&sensor=false


Where Address__c => Field which hold Address in Text type

Why pay more for paper-writing services than you get to? understands that students get special budgets to exercise with. research paper note taking based Be deliberate of binge that you receive on the ordinary WWW. Finally you will towards sure turn garbled

How to generate dynamic queries in apex for sObjects & fields

//return a dynamic Query string that includes all the direct sObject fields and the related Name fields from the parent objects
//dependent method of getSobjects
//TODO: move this into platform wide sobject utils class as it is not domain specific
public static String getBaseQuery(String objName, List<String> customFields)
// get the describe info for the org, object and its fields
Map<String,Schema.SObjectType> orgMap = Schema.getGlobalDescribe();
Schema.SObjectType sObjType = orgMap.get(objName);
Schema.DescribeSObjectResult sObjDescribe = sObjType.getDescribe();
Map<String, Schema.SObjectField> sObjFieldMap = sObjDescribe.fields.getMap();
List<Schema.SObjectField> sObjFieldList = sObjFieldMap.values();
//build out the base soql query using the describe info
String soqlQuery = ‘SELECT ‘;
for(Schema.SObjectField sObjField : sObjFieldList)
String fieldLabel = sObjField.getDescribe().getLabel();
String fieldName = sObjField.getDescribe().getName();
String fieldType = String.valueOf(sObjField.getDescribe().getType());
String relationshipName = sObjField.getDescribe().getRelationshipName();
System.debug(‘>>>>>>>>>>>>>>>>>>>> Label = ‘ + fieldLabel + ‘ Name = ‘ + fieldName + ‘ Type = ‘ +
fieldType + ‘ relationshipName = ‘ + relationshipName);
// add each field to the base soql query
soqlQuery += ‘ ‘ + fieldName + ‘,’;
// if this is a lookup field, also include the name field of the parent
if((‘REFERENCE’.equalsIgnoreCase(fieldType) == true) && ((relationshipName != null) && (relationshipName.length() > 0)))
// add the name field from the parent object to the base soql query
soqlQuery += ‘ ‘ + relationshipName + ‘.Name,’;
// add additional custom fields specified in the call to the base soql query
if((customFields != null) && (customFields.size() > 0))
for(String customField : customFields)
soqlQuery += ‘ ‘ + String.escapeSingleQuotes(customField) + ‘,’;
// remove the last comma from the base query
soqlQuery = soqlQuery.subString(0, soqlQuery.length() – 1);
// add the from clause to the base query
soqlQuery += ‘ FROM ‘ + objName + ‘ ‘;
//return the dynamic base soql query string
return soqlQuery;

  • 1
  • 2

Need more help?

Hi there, was your problem or query resolved? If not & need more assistance, please do reach out to us at, we'll be more than delighted to help. Nanostuffs has 7+ years of extensive Salesforce & iOS/Android experience.
Holler Box