Difference between Database.query() and Database.getQueryLocator



Database.query()
Database.getQueryLocator
We can retrieve up to 50,000 records.
We can retrieve up to 10,000 records.
If VF page doesn’t have read only attribute, use Database.query().
If VF page have read only attribute, use Database.getQueryLocator().
In Batch Apex, if we use Database.query(), it supports 50,000 records only.
In Batch Apex, if we use Database.getQueryLocator(), it supports upto 50 million records.

Cheers!!!

Sub Modules of CRM

A Typical CRM consists of 3 Sub Modules:

•        Marketing (Lead, Campaign, Account and Contact Management)

•        Sales (Account, Contact and Opportunity Management)

•        Services (Account, Contact, Cases and Solutions Management)

Cheers!!!

How to add Javascript to Standard Pagelayout in Salesforce?

To add Javascript to Standard Pagelayout in Salesforce, add a HTML Home page Component with HTML checkbox checked.


Sample Javascript:

<style type="text/css">
#popup
{
display:none;
position:absolute;
height:100px;
width:100px;
background:#E6E6FA;     
border: 2px solid black;
overflow:auto;
}
#cls
{
color:red;
text-align:right;
}
</style>

<script type="text/javascript" src="/soap/ajax/22.0/connection.js"></script>

<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js" type="text/javascript"></script>

<script type="text/javascript">
    $(document).ready( function(){

        $(".dataCell").click(function(event){   
            $("#popup").css( {position: "absolute", top:event.pageY - 110, left: event.pageX});
            var temp = $(this).prev(".dataCell").find("a").attr("href");
            var depLink = temp.substring(1);           
            var qryString = "SELECT Description__c FROM Dependent__c where Id = '" + depLink + "'";
            sforce.connection.sessionId = getCookie('sid');
            var soql = qryString.toString();
           
            var result = sforce.connection.query(soql);   
           
            var records = result.getArray("records");
            for (var i = 0; i < records.length; i++)
            {
                var taskRecord = records[i];
                $("#cont").html(taskRecord.Description__c);
            }           
           
            showBox();
        });

        $("#cls").click(function(){
            hideBox();
        });

        function showBox()
        {
            $('#popup').fadeIn("slow");
        }
        function hideBox()
        {
            $('#popup').fadeOut("slow");
        }
    });
</script>
<div id="popup">
    <div id="cls">
    <a href="#" style="color:red;">X</a><br/>
    </div>
    <div id="cont"></div>
</div>


Output:


CSS is not working

If applied CSS is not working, then try to avoid blank spaces in the CSS.

Good CSS:

#popup
{
display:none;
position:absolute;
height:100px;
width:100px;
background:#E6E6FA;     
border: 2px solid black;
overflow:auto;
}


Bad CSS:

#popup
{

    display:none;
    position:absolute;
    height:100px;
    width:100px;
    background:#E6E6FA;     
    border: 2px solid black;
    overflow:auto;
}

Cheers!!!

Tags in Salesforce

 Tags are words or short phrases that you can associate with most Salesforce records to describe and organize their data in a personalized way. Use tags to group records from various objects by a common topic or use, and then use those tags in search to make finding information fast and intuitive.

Types of tags:

    1. Personal tags are private. Only you can view any personal tags that you add to a record.
    2. Public tags are shared among all users in an organization. Any user with access to the record can view the public tags that you add.

Administrators can enable personal and public tags for accounts, activities, assets, campaigns, cases, contacts, contracts, dashboards, documents, events, leads, notes, opportunities, reports, solutions, tasks and for any custom objects.

In order to enable Tags, go to Setup --> Customize --> Tags --> Tag Settings.



For Public tags, kindly check Public Tags and for Personal Tags, kindly select Personal Tags.


 To add, tag to a record, kindly click "Add Tags" button.


Give a name to the tag and save it.


Search the tag name in the Search bar.


Output:


Limitations:

For all editions, a user is limited to a maximum of: 

• 500 unique personal tags
• 5,000 instances of personal tags applied to records

Across all users, your organization can have a maximum of:

• 1,000 unique public tags
• 50,000 instances of public tags applied to records
• 5,000,000 instances of personal and public tags applied to records

Cheers!!!

ADM 201 Book

How to add custom button to related list in Salesforce?

1. Create a List Custom button on child object.


2. Go the parent object.

3. Edit the page layout.

4. Go to related list.

5. Click 'Settings' icon.


6. Select the button to be displayed.



7. Click 'Save'.


Cheers!!!

How to create custom tab style in Salesforce?

1. Go to Documents tab.


2. Add a image less than 20kb in size.

3. Check "Externally Available Image" checkbox without fail.


 4. Go to App setu --> Create --> Tabs and click "New" button.


 5. Click the magnifying glass icon next to Tab style and click "Create your own style" button.




6. Select Color and icon from the image stored in Documents.


This dialog only lists files in document folders that are under 20 KB and have the Externally Available checkbox selected in the document property settings. If the document used for the icon is later deleted, Salesforce replaces it with a default multicolor block icon (Default Block Icon).

Ouputs:


Freshers Drive


"Connecting Fresh Talent with Right Opportunity"

Freshers Drive on 18th May 2013

Who are eligible-
• B.E/B.Tech/M.Tech/M.E/MCA/M.Sc (IT/CS Branches ONLY)
• 70% minimum throughout the education (Compulsory)
• Only 2012 & 2013 Batch will be considered

Interview Date: 18-05-2013
Registration Timings: 8.00 AM to 9.00 AM
Interview Timings: 9.00 AM Onwards

Interview Procedure-
• Aptitude Test (1 hr)
• Essay Writing (1/2 hr)
• Group Discussion
• Personal Interview

Documents to be carried:
• Hard Copy of the profile
• One passport size photograph

Venue Details - HighRadius Technologies Pvt. Ltd.
Ektha Pearl, 4th Floor, 1st Lane, White Fields,
BP Raju Marg, Kondapur, Hyderabad-500084.

Salesforce Interview questions with answers Part 13

1. In Data loader using upsert operation can u do update a record if that record id is already exist in page and if updated that record then can u update 2records with having same id and if not updated 2 records then wat error message is given?

It is not possible to update records with same id in a file usin upsert operation. It will throw "duplicate ids found" error.

2. One product cost is 1000. It is stored in invoice so once if change the cost of product to 800 then how can i update it automatically into a invoice?

We can achieve this using triggers or through relationship among objects.

3. One company is having some branches and all branches having different departments. So, now I want to display all departments from all branches in a single visualforce page?

Using subquery we can fetch all the required data and we can display it in VF page.

Summer ‘13 Certification Maintenance

The Summer ‘13 product releases will occur on May 17, 2013, June 7, 2013 and June 14, 2013. As a certified professional, you will be responsible for completing the Summer ‘13 release exam(s) in order to maintain your certification credential(s).

The Release Training can also be accessed here:

To learn more about what’s new in the Summer ‘13 release, review the release notes:

Deadlines to Complete Release Exams:

·         Winter ‘13 exams must be completed by Friday, June 28, 2013 (applies to individuals certified in Summer ‘12 or earlier)
·         Spring ’13 exams must be completed by Friday, November 1, 2013 (applies to individuals certified in Winter ’13 or earlier)
·         Summer ‘13 exams must be completed by Friday, February 28, 2014 (applies to individuals certified in Spring ’13 or earlier)

Salesforce Interview questions with answers Part 12

1. Can you please give some information about Implicit and Explicit Invocation of apex?
 
Triggers - Implicit

Javascript remoting - Explicit

2. what is apex test execution?

 
Exectuing apex test classes

3. what is meant by email services in salesforce?

http://infallibletechie.blogspot.com/2012/12/inbound-email-creating-record-using.html

5. How can we know few time based workflows has been fired and some more are still need to fire?

http://infallibletechie.blogspot.com/2013/05/how-can-we-track-which-time-based.html

6. In an apex invocation how many methods that we can write as future annotations?


10

7. How can we track which time based wf's are fired and which are in the queue?

http://infallibletechie.blogspot.com/2013/05/how-can-we-track-which-time-based.html

How can we track which time based workflows are fired and which are in the queue?

To track which time based workflows are fired and which are in the queue, kindly go to Setup --> Monitoring  -> Time Based Workflow.


Advantages of Salesforce CRM

  1. Flexibility
  2. Disaster Recovery
  3. Automatic Software updates
  4. Increased Collaboration
  5. Work from anywhere
  6. Document Control
  7. Security
  8. Environmentally friendly

How to find object type from Salesforce record id?

Sample Code:

Visualforce page:

<apex:page Controller="sample" sidebar="false" >
<apex:form >
    <apex:pageblock id="pg" >
        <apex:pageblockSection >
            <apex:pageBlockSectionItem >Record Id</apex:pageBlockSectionItem>
            <apex:pageblockSectionItem ><apex:inputtext value="{!recId}" /></apex:pageblockSectionItem>
        </apex:pageblockSection>
        <apex:pageBlockButtons >
            <apex:commandButton value="Find" action="{!find}" reRender="pg"/>
        </apex:pageBlockButtons>
        <apex:outputText >The object type is : {!objType}</apex:outputText>
    </apex:pageblock>
</apex:form>  
</apex:page>


Apex: Controller:

public with sharing class sample {
    public Id recId {get;set;}
    public String output {get;set;}
    public Schema.SObjectType objType {get;set;}
   
    public void find() {
        objType = recId.getSobjectType();
        System.debug('Object Type is ' + objType);
    }
}


Output:



Cheers!!!

Why Salesforce.com?

  1. Easy to use
  2. Easy to set up
  3. Click to customize
  4. No software hassles
  5. Security
  6. Ease of implementation
  7. Ease of administration
  8. Features
  9. Price
  10. Customer Support
Cheers!!!

What is Salesforce.com?

Salesforce.com is a cloud computing and social enterprise software-as-a-service (SaaS) provider based in San Francisco. It was founded in March 1999, in part by former Oracle executive Marc Benioff. Cloud computing is a general term for anything that involves delivering hosted services over the Internet. In the software-as-a-service cloud model, the vendor supplies the hardware infrastructure, the software product and interacts with the user through a front-end portal.

Salesforce.com is a web based CRM tool that helps us to maintain the relationship with the customers.

Salesforce.com is a good example for Cloud computing services.

Salesforce.com uses Multi tenant architecture.

Leaders in cloud computing systems for customer relationship management, CRM, sales, social, call centre, knowledge management software cloud computing. 

Cheers!!!

Visualforce Email Template with custom controller

Apex Controller:

public  class acctTemplt
{
    public Id accountId {get;set;}
    public List<Opportunity> getopptys()
    {
        List<Opportunity> oppty;
        oppty = [SELECT Name, StageName FROM Opportunity WHERE Accountid =: accountId];
        return oppty;
    }
}


Component:

Name:OpptyList

<apex:component controller="acctTemplt" access="global">
    <apex:attribute name="AcctId" type="Id" description="Id of the account" assignTo="{!accountId}"/>
    <table border = "2" cellspacing = "5">
        <tr>
            <td>Opportunity Name</td>
            <td>Opportunity Stage</td>               
        </tr>
        <apex:repeat value="{!opptys}" var="o">
        <tr>
            <td>{!o.Name}</td>
            <td>{!o.StageName}</td>             
        </tr>
        </apex:repeat>       
    </table>
</apex:component>


Visualforce Email template:

<messaging:emailTemplate subject="List of opportunity" recipientType="User" relatedToType="Account">
    <messaging:htmlEmailBody >
    Hi,<br/>
    Below is the list of opportunities for your account {!relatedTo.Name}.<br/><br/>
    <c:OpptyList AcctId="{!relatedTo.Id}" /><br/><br/>
    <b>Regards,</b><br/>
    {!recipient.FirstName}
    </messaging:htmlEmailBody>
</messaging:emailTemplate>


Output:



Cheers!!!

Difference between created, created, and every time it’s edited and created, and any time it’s edited to subsequently meet criteria



created
Evaluate the rule criteria each time a record is created. If the rule criteria is met, run the rule. Ignore all updates to existing records.
With this option, the rule never runs more than once per record.
created, and every time it’s edited
Evaluate the rule criteria each time a record is created or updated. If the rule criteria is met, run the rule.
With this option, the rule repeatedly runs every time a record is edited, as long as the record meets the rule criteria.
Note: We cannot add time-dependent actions to the rule if you select this option.
created, and any time it’s edited to subsequently meet criteria
Evaluate the rule criteria each time a record is created or updated.
  • For a new record, run the rule if the rule criteria is met.
  • For an updated record, run the rule only if the record is changed from not meeting the rule criteria to meeting the rule criteria.
With this option, the rule can run multiple times per record, but it won’t run when the record edits are unrelated to the rule criteria.

If we want to trigger the workflow only when the record is created, we have to use “created”.

If we want to trigger the workflow whenever the record is created or edited even though it has currently met and triggered, we have to use “”.

If we want to trigger the workflow whenever the record is created or edited and previously it didn’t meet the criteria.

Cheers!!!

Simple Visualforce Email Template

Template:

<messaging:emailTemplate subject="Test" recipientType="User" relatedToType="Employee__c" >
<messaging:htmlEmailBody >
    <table>
        <tr>
            <td>Hi {!relatedTo.Employee_Name__c},</td>
        </tr>
        <tr>
            <td>Welcome to Accord Info Matrix</td>
        </tr>       
    </table>
    Regards,<br/>
    {!recipient.FirstName}
</messaging:htmlEmailBody>
</messaging:emailTemplate>


Output:


Link to download Apex Data Loader without login

1. Open the below URL

http://www.cloudsuccess.com/resource-centre/apex-data-loader-archive/

2. Under Data Loader : Download Current Version, click the small icon in the left side of the image to download the latest Apex Data Loader


Cheers!!!

Salesforce Interview questions with answers Part 11

1. I want to update 10 records ,can I use Trigger.new?

Yes.

2. In Page layouts I want to change the Order of the layout.how can you do that?

Edit the layout.


3. Profile?what is permission set?

http://www.infallibletechie.com/2012/11/what-are-permission-sets-and-how-do.html

4. What is after update and before update?

http://infallibletechie.blogspot.com/2013/02/before-trigger-in-case-of-validation.html

5. Every month 1st I need to insert a record in 1 object?how will you do that?


Schedule a class. Check the below for example


http://www.infallibletechie.com/2012/05/apex-scheduler.html

6. How many types of controllers are there?

3 types.

Custom Controller.
Standard Controller.
Extensions.

7. I want to use more than 1 object in visual force pages?which controller will you use?

Extensions. 


8. I want new 1 button on the detail page of standard Object ?how can you do it?

Create a button in that object and assign it to the page layout.

9. What is trigger and bulk trigger ?


http://infallibletechie.blogspot.com/2012/11/how-to-bulkify-trigger-code.html

10. For which events will trigger.new will support?


Insert and update.

Cheers!!!

Salesforce Interview questions with answers Part 10

1. Write a query for below.
 
I have 1 parent(account) and 1 child(contact),how will you get F.name,L.name from child and email from the account when Organization name in account is "CTS"?

SELECT Email, (SELECT F.Name, L.Name FROM Contacts) FROM Account WHERE Name = 'CTS'.

2. what are workflow actions?


Field Update
Task
Email Alert
Outbound Message

3. What are outbound messages?what it will contain?

In outbound message contains end point URL.

4. What is External id?primary id?
External id is unique to external application.
Primay id is unique to internal organization.

5. Data loader?and which format it will support?

Data loader is a tool to manage bulk data. It will support .csv format of Excel.

6. How import wizard will not allow the duplicates?Using external id.

7. What are validation rules?

Used to maintain data format.

8. Recursive triggers?where you have used?

http://infallibletechie.blogspot.com/2012/08/recursive-triggers-in-salesforce.html

State and Country Picklists—Beta in Salesforce

State and country picklists allow users to select states and countries from predefined, standardized lists, instead of entering state and country data into text fields.

State and country picklists allow for faster and easier data entry. Reports, email templates, and list views are automatically updated and no need of Validation Rules and Triggers for data entry.

State and country picklists are available on certain standard objects.

In this beta release, you can access and use the new picklists in most places that state and country fields are available in Salesforce, including:
  •     Record edit and detail pages
  •     List views, reports, and dashboards
  •     Filters, functions, rules, and assignments
In this beta release, state and country picklists do not work with:
  •     Campaign Members
  •     Translation Workbench
  •     Salesforce to Salesforce
  •     Salesforce Touch or Salesforce Mobile
  •     Visual Workflow, packaging, or partner portals
  •     Custom indexes or outbound messages

Cheers!!!

Salesforce multitenant architecture

Multitenancy refers to a standard in software architecture where a single instance of the software runs on a server, serving multiple client organizations (tenants). A software application is designed to virtually partition its data and configuration, and each client association works with a customized virtual application instance. Multitenancy is the fundamental technology that clouds use to share IT resources cost-efficiently and securely.

Tenants share IT resources securely among multiple applications and tenants (businesses, organizations, etc.).

Tenants do not share data among other Tenants.

Data to a Tenant is found using the OrgID.

To prevent malicious or unintentional monopolization of shared, multitenant system resources, Force.com has an extensive set of governors and resource limits associated with Force.com code execution. For example, Force.com closely monitors the execution of a code script and limits how much CPU time it can use, how much memory it can consume, how many queries and DML statements it can execute, how many math calculations it can perform, how many outbound Web services calls it can make, and much more.  So, a tenant cannot perform an unlimited number of database operations.

For more info, view the below site

http://www.infoq.com/presentations/SalesForce-Multi-Tenant-Architecture-Craig-Weissman

Cheers!!!

Salesforce Interview questions with answers Part 9

1.       Ajax Components in V.F?

apex:actionPoller, apex:actionFunction, apex:actionSupport, etc.

2.       Salesforce sites?

Used to show data from our organization for public view.

3.       Rendered and Re Rendered and Re Renderdas?

http://infallibletechie.blogspot.com/2012/10/difference-between-rendered-renderas.html

4.       Auto-response rules and Escalation rules(for which objects are mandatory)?

Case and Lead.

5.       Difference between REST and SOAP API'S?

Varies on records that can be handled.

6.       What is creating debug log for users?


Track code

7.       Diff SOQL and SOSL?

http://infallibletechie.blogspot.com/2012/10/difference-between-sosl-and-soql.html

8.       What is Action support and Action pollar in V.F?

http://infallibletechie.blogspot.com/2012/10/apexactionpoller.html

9.       Diff Mater-detail & Lookup?

http://infallibletechie.blogspot.com/2013/02/difference-between-lookup-and-master.html

10.   What is Dynamic Apex?

http://infallibletechie.blogspot.com/2012/10/dyanamic-apex.html

11.   How cases are created?

Email to Case and Web to Case

12.   How many events are there in Triggers?

http://infallibletechie.blogspot.com/2013/01/triggers-in-salesforce.html

13.   What is after undelete?

While retrieving from recycle bin

14.   Will Trigger.new supports --->Insert,,,Will Trigger.Delete supports --->Delete

Yes.

15.   What is Inline visualforce page?

Having vf page in pagelayout.

16.   Diff between Profile and permission sets?

http://infallibletechie.blogspot.com/2012/11/what-are-permission-sets-and-how-do.html

17.   Diff between role and profile?

http://infallibletechie.blogspot.com/2012/12/difference-between-roles-and-profiles.html

18.   What are sharing rules?and how many types of sharings are there?

http://infallibletechie.blogspot.com/2012/11/sharing-rules.html

19.   JSON?

http://infallibletechie.blogspot.com/2012/10/generating-json-in-visualforce-page-in.html

20.   Do you know about Portals?

http://infallibletechie.blogspot.com/2013/02/customer-portal-implementation-in.html

21.   If is child is mandatory field in lookup and I m deleting Parent,will child get deleted?

No.

22.   Junction object?when will we use?If we delete the junction object what will happen?

For many to many relationship.

23.   Diff between controller and Extension?


http://infallibletechie.blogspot.com/2012/11/difference-between-standardcontroller.html

24.   What is Dynamic SOQL?

http://infallibletechie.blogspot.com/2012/10/dynamically-getting-picklist-values.html

25.   Context Variables in Triggers?

http://infallibletechie.blogspot.com/2013/05/context-variables-in-triggers.html

26.   Trigger.new and Trigger.old?

http://infallibletechie.blogspot.com/2012/04/difference-between-triggernew-and.html

27.   Can we have V.F pages in page layout?


Yes.

Context Variables in triggers

Context Variables in triggers are isExecuting, isInsert, isUpdate, isDelete, isBefore, isAfter, isUndelete, new, newMap, old, oldMap, size.

isExecuting
Returns true if the current context for the Apex code is a trigger, not a Visualforce page, a Web service, or an executeanonymous() API call.
isInsert
Returns true if this trigger was fired due to an insert operation, from the Salesforce user interface, Apex, or the API.
isUpdate
Returns true if this trigger was fired due to an update operation, from the Salesforce user interface, Apex, or the API.
isDelete
Returns true if this trigger was fired due to a delete operation, from the Salesforce user interface, Apex, or the API.
isBefore
Returns true if this trigger was fired before any record was saved.
isAfter
Returns true if this trigger was fired after all records were saved.
isUndelete
Returns true if this trigger was fired after a record is recovered from the Recycle Bin (that is, after an undelete operation from the Salesforce user interface, Apex, or theAPI.)
new
Returns a list of the new versions of the sObject records.
Note that this sObject list is only available in insert and update triggers, and the records can only be modified in before triggers.
newMap
A map of IDs to the new versions of the sObject records.
Note that this map is only available in before update, after insert, and after update triggers.
old
Returns a list of the old versions of the sObject records.
Note that this sObject list is only available in update and delete triggers.
oldMap
A map of IDs to the old versions of the sObject records.
Note that this map is only available in update and delete triggers.
size
The total number of records in a trigger invocation, both old and new.



Cheers!!!