July 30, 2014

BE, B.Tech, ME, M.tech, MCA - 2014 Passouts - Freshers - L& T



Cheers!!!

July 25, 2014

How to convert 15 to 18 digit Id using apex in Salesforce?

Sample Code:

        String fifteenDigit = '0SO90000000PBDu';
Id eighteenDigit = fifteenDigit;        
        system.debug('15 Digit Id is ' + fifteenDigit);
system.debug('18 Digit Id is ' + eighteenDigit);

Output:


Cheers!!!

July 24, 2014

Summer ‘14 Certification Maintenance for Administrators

To prepare for the Salesforce.com Certified Administrator Summer ‘14 Certification Maintenance,

Access the Release Training here:
http://www.salesforce.com/customer-resources/releases/summer14/release-training.jsp

Download the Release Notes here:
https://na1.salesforce.com/help/pdfs/en/salesforce_summer14_release_notes.pdf

You will have 3 attempts to pass the exam. There are 11 exam questions and the passing score is 73%.

Last Date:
October 31, 2014, prior to the next release (Winter ‘15).

Please visit the schedule page for exact details: http://certification.salesforce.com/schedules.


Cheers!!!

Summer ‘14 Certification Maintenance for Developer

To prepare for the exam, Salesforce.com Certified Force.com Developer Summer ‘14 Certification Maintenance,

Access the Release Training here:
http://www.salesforce.com/customer-resources/releases/summer14/release-training.jsp

Download the Release Notes here:


https://na1.salesforce.com/help/pdfs/en/salesforce_summer14_release_notes.pdf

You will have 3 attempts to pass the exam. There are 5 exam questions and the passing score is 80%.

Last Date:
October 31, 2014, prior to the next release (Winter ‘15).

Please visit the schedule page for exact details: http://certification.salesforce.com/schedules.

Cheers!!!

How to login into Salesforce using Google credentials?

To login into Salesforce using Google credentials, use the below steps

1. Go to "https://console.developers.google.com/project".

2. Click "Create Project".


3. Enter project name and click "Create".


4. Go to "Credentials" and click "Create new Client ID".


5. Select "Web Application", remove default in "AUTHORIZED JAVASCRIPT ORIGINS" and click "Create Client ID".


6. Go to "Consent Screen" and enter the Product Name.


7. Go to your Salesforce.com Setup --> Administer --> Security Controls --> Auth. Providers and click "New".


8. Enter the details as below.


In order to get the Consumer Key and Consumer Secret, get Client Id and Client Secret from your Google Project.


9. Copy the Callback URL from Auth. Provider and paste it in Redirec URI.




10. An apex class would have been created. Go to Setup --> Build --> Develop --> Apex Classes and edit the class as mentioned below.

global class AutocreatedRegHandler1406191530150 implements Auth.RegistrationHandler {
    global User createUser(Id portalId, Auth.UserData data) {
        User u = [SELECT Id FROM User WHERE Email =: data.email];
        return u;
    }
    
    global void updateUser(Id userId, Id portalId, Auth.UserData data) {
    }
}

here you can make use of data.FirstName, data.LastName, data.FullName, openid(Google Profile Id) also.

11. Copy the Test-Only authrorization url and paste it in your brower and press enter.




12. Provide Single Sign-On Initialization URL to your organization user to login into Salesforce using Google credentials.

Note: Sometimes, it will get some time to get synchronized. If you get any error in the URL, kindly try after sometime.

Cheers!!!

How to login into Salesforce using Facebook credentials?

To login into Salesforce using Facebook credentials, use the below steps

1. Go to "https://developers.facebook.com/". Click "Create a New App".


2. Enter Name, Namespace, select category and click "Create App" button.


3. In your Salesforce account, go to Setup --> Administer --> Security Controls --> Auth. Providers and click "New" button.


5. Enter the details correctly as mentioned below and click "Save" button.


In order to get the consumer key and consumer secret, go to your facebook app and copy it from there.


6. An apex class would have been created. Go to Setup --> Build --> Develop --> Apex Classes and edit the class as mentioned below.

global class AutocreatedRegHandler1406129749186 implements Auth.RegistrationHandler{
    global User createUser(Id portalId, Auth.UserData data) {
        User u = [SELECT Id FROM User WHERE Email =: data.email];
        return u;
    }
    
    global void updateUser(Id userId, Id portalId, Auth.UserData data) {
    }
}

here you can make use of data.FirstName, data.LastName, data.FullName also.

7. Go to your facebook app and click "Settings". Click "Add platform".


8. Select "Website".


9. Copy the Callback url from Auth. Provider and paste it in Site URL and click "Save Changes".



10.  Copy the Test-only Initialization url from Auth. Provider and open it in the browser.



11. Copy the Single Sign-On Initialization URL and provide it to your users to use Facebook credentials for login into Salesforce.com.

Note: Sometimes, it will get some time to get synchronized. If you get any error in the URL, kindly try after sometime.

Cheers!!!

July 21, 2014

Validate and Deploy difference in Salesforce

Validate:
Validate change sets before deployment
You can perform a test deployment of an inbound change set to view the success or failure messages that would occur with an actual deployment.

Deployment:
Actual deployment.

Cheers!!!

How to retrieve standard objects using ANT in Salesforce?

Account
<members>Account</members>
AccountContactRole
<members>AccountContactRole</members>
Asset
<members>Asset</members>
Campaign
<members>Campaign</members>
CampaignMember
<members>CampaignMember</members>
Case
<members>Case</members>
CaseComment
<members>CaseComment</members>
CaseContactRole
<members>CaseContactRole</members>
Contact
<members>Contact</members>
Contract
<members>Contract</members>
ContractContactRole
<members>ContractContactRole</members>
Lead
<members>Lead</members>
Opportunity
<members>Opportunity</members>
OpportunityContactRole
<members>OpportunityContactRole</members>
OpportunityLineItem
<members>OpportunityLineItem</members>
PartnerRole
<members>PartnerRole</members>
Product2
<members>Product2</members>
Quote
<members>Quote</members>
QuoteLineItem
<members>QuoteLineItem</members>
Solution
<members>Solution</members>

For more info, check this - http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_list.htm


Cheers!!!

July 19, 2014

Security Settings in Salesforce

Record level security

     1)     OWD - Organization Wide Default
            a)  Private
            b)  Public read only
            c)  Public Read/Write
            d)  Public Read/Write/Transfer(Only for Case and Lead)
            e)  Public Full Access(Only for Campaign)
     2)     Role Hierarchy
     3)     Sharing Rule
     4)     Manual Sharing

Object level security

     1)     Profile
            a)  CRED or CRUD
            b)  View All
            c)  Modify All
            d)  View All Data
            d)  Modify All Data
     2)     Permission Set

Cheers!!!

July 18, 2014

Salesforce Components names for ANT tool

Sample Package.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">

    <!-- Custom Object Tab, LWC or Aura Custom Tab, Web Tab and Visualforce tab -->
    <types>
        <members>Employee__c</members>
        <name>CustomTab</name>
    </types>

    <types>
        <members>*</members>
        <name>ApexClass</name>
    </types>

    <types>
        <members>*</members>
        <name>ApexComponent</name>
    </types>

    <types>
        <members>*</members>
        <name>ApexPage</name>
    </types>

    <types>
        <members>*</members>
        <name>ApexTrigger</name>
    </types>

    <types>
        <members>*</members>
        <name>CustomApplication</name>
    </types>

    <types>
        <members>Activity.Closed__c</members>
        <name>CustomField</name>
    </types>

    <types>
        <members>*</members>
        <members>Account</members>
        <name>CustomObject</name>
    </types>

    <types>
        <members>*</members>
        <name>CustomTab</name>
    </types>

    <types>
        <members>Images/Logo.png</members>
        <name>Document</name>
    </types>

    <!--     For retrieving and deploying Email Templates, folder name is mandatory       -->
    <types>
        <members>unfiled$public/Test_Notification</members>
        <members>EmailTemplates/InquiryPortal</members>
        <name>EmailTemplate</name>
    </types>

    <types>
        <members>*</members>
        <name>HomePageComponent</name>
    </types>
    <types>
        <members>*</members>
        <name>HomePageLayout</name>
    </types>
    <!-- Home Page Custom Link -->
    <types>
        <members>*</members>
        <name>CustomPageWebLink</name>
    </types>
    <types>
        <members>Account.My_Account_Team</members>
        <name>ListView</name>
    </types>
    <types>
        <members>Account-Account Layout</members>
        <name>Layout</name>
    </types>

    <types>
        <members>Analyst</members>
        <name>Profile</name>
    </types>

    <types>
        <members>ExtraReports</members>
        <!--Report Folder-->
        <members>ExtraReports/AnyOccupation</members>
        <!--Report-->
        <members>unfiled$public/Test</members>
        <!--Report from Unfiled Public Reports-->
        <name>Report</name>
    </types>

    <types>
        <members>ExtraDashboards</members>
        <!--Dashboard Folder-->
        <members>ExtraDashboards/AnyOccupation</members>
        <!--Dashboard-->
        <name>Dashboard</name>
    </types>

    <types>
        <members>*</members>
        <name>ReportType</name>
    </types>

    <types>
        <members>*</members>
        <name>StaticResource</name>
    </types>

    <types>
        <members>Contact.SelectTitle</members>
        <name>WebLink</name>
    </types>

    <types>
        <members>*</members>
        <name>PermissionSet</name>
    </types>

    <types>
        <members>*</members>
        <name>QuickAction</name>
    </types>

    <!-- 
 Workflow includes WorkflowFieldUpdate,
 WorkflowAlert, WorkflowOutboundMessage, WorkflowRule
    -->
    <types>
        <members>ObjectName</members>
        <name>Workflow</name>
    </types>

    <types>
        <members>ObjectName.WorkflowRuleName</members>
        <name>WorkflowRule</name>
    </types>

    <types>
        <members>ObjectName.FieldUpdateName</members>
        <name>WorkflowFieldUpdate</name>
    </types>

    <types>
        <members>ObjectName.EmailAlertName</members>
        <name>WorkflowAlert</name>
    </types>

    <types>
        <members>ObjectName.OutboundMessageName</members>
        <name>WorkflowOutboundMessage</name>
    </types>

    <types>
        <members>ObjectName.TaskName</members>
        <name>WorkflowTask</name>
    </types>

    <!--        Custom Button/Link         -->
    <types>
        <members>Directory_Edition__c.Final_Letter_Renewal</members>
        <name>WebLink</name>
    </types>

    <!--        Standard Tabs and Fields renames        -->
    <types>
        <members>*</members>
        <name>CustomObjectTranslation</name>
    </types>

    <!--        Validation Rules        -->
    <types>
        <members>Object Name.Validation Name</members>
        <name>ValidationRule</name>
    </types>

    <!--        Record Types        -->
    <types>
        <members>Object Name.Record Type Name</members>
        <name>RecordType</name>
    </types>

    <!--       Role        -->
    <types>
        <members>*</members>
        <name>Role</name>
    </types>

    <!--       Queue        -->
    <types>
        <members>*</members>
        <name>Queue</name>
    </types>

    <!--       Public Group        -->
    <types>
        <members>*</members>
        <name>Group</name>
    </types>

    <!--      Custom Labels        -->
    <types>
        <members>*</members>
        <name>CustomLabel</name>
    </types>

    <!--      LetterHead       -->
    <types>
        <members>*</members>
        <name>Letterhead</name>
    </types>

    <!--      Process Builder and Flow  -->
    <types>
        <members>Process_Builder_API_Name-versionNo</members>
        <name>Flow</name>
    </types>

    <types>
        <members>LogACall</members>
        <!--Global Action -->
        <members>Task.TestingAction</members>
        <!--Object Quick Action -->
        <name>QuickAction</name>
    </types>

    <!-- Platform Event -->
    <types>
        <members>EventName__e</members>
        <name>CustomObject</name>
    </types>

    <!-- Sharing Rule -->
    <types>
        <members>Account.*</members>
        <name>SharingCriteriaRule</name>
    </types>

    <types>
        <members>Account.*</members>
        <name>SharingOwnerRule</name>
    </types>

    <types>
        <members>*</members>
        <name>SharingTerritoryRule</name>
    </types>


    <!-- Lightning Component -->
    <types>
        <members>ComponentName</members>
        <name>AuraDefinitionBundle</name>
    </types>

    <!-- Lightning Record Pages / Lightning App Builder Pages -->
    <types>
        <members>Account_Record_Page</members>
        <name>FlexiPage</name>
    </types>

    <!-- Duplicate Rule -->
    <types>
        <members>Lead.Test_Duplicates_Rule</members>
        <name>DuplicateRule</name>
    </types>

    <!-- Matching Rule -->
    <types>
        <members>Lead.Test_Lead_Matching_Rule</members>
        <name>MatchingRule</name>
    </types>

    <!-- Custom Settings -->
    <types>
        <members>Common_Settings__c</members>
        <name>CustomObject</name>
    </types>

    <!-- Opportunity Stage -->
    <types>
        <members>OpportunityStage</members>
        <name>StandardValueSet</name>
    </types>

    <!-- Case Status -->
    <types>
        <members>CaseStatus</members>
        <name>StandardValueSet</name>
    </types>

    <!-- Task Type -->
    <types>
        <members>TaskType</members>
        <name>StandardValueSet</name>
    </types>

    <!-- Lead Fields Mappings -->
    <types>
        <members>*</members>
        <name>LeadConvertSettings</name>
    </types>

    <!-- Custom Metadata Type Data - do not use __mdt for records -->
    <types>
        <members>CustomMetadata.RecordName</members>
        <name>CustomMetadata</name>
    </types>

    <!-- Custom Metadata Type -->
    <types>
        <members>CustomMetadata__mdt</members>
        <name>CustomObject</name>
    </types>

    <!-- Field Set -->
    <types>
        <members>ObjectAPIName.FieldSetAPIName</members>
        <name>FieldSet</name>
    </types>

    <!-- Lightning Web Component or LWC -->
    <types>
        <members>LWCName</members>
        <name>LightningComponentBundle</name>
    </types>

    <!-- In-App Guidance -->
     <types>
        <members>*</members>
        <name>Prompt</name>
    </types> 

    <!-- Global Picklist/Picklist Value Set -->
    <types>
        <members>*</members>
        <name>GlobalValueSet</name>
    </types>

    <!-- Remote Site Settings -->
    <types>
        <members>Test</members>
        <name>RemoteSiteSetting</name>
    </types>

    <!-- Path Settings ---> 
   <types>
        <members>Opportunity.Easy Deal</members>
        <name>BusinessProcess</name>
    </types>
    <types>
        <members>Opportunity.StageName</members>
        <name>CustomField</name>
    </types>
    <types>
        <members>Easy_Deal</members>
        <name>PathAssistant</name>
    </types>
    <types>
        <members>Opportunity.Easy_Deal</members>
        <name>RecordType</name>
    </types>
    <types>
        <members>PathAssistant</members>
        <name>Settings</name>
    </types>
    <!-- Path Settings -->  

    <version>51.0</version>

</Package>

July 15, 2014

How to schedule Update reminders in Salesforce?

1. Go to My Settings.


2. Under Calendar & Reminders, select My Update Reminder.


3. Select the required fields and click "Save" button.


Sample Email:



Update Reminder in Salesforce

Updated and accurate opportunities drive precise forecasts. Ensure that your opportunities are up to date by enabling managers to schedule opportunity update reminders—automated opportunity reports that managers can customize for their teams.

1. Go to Setup --> Build --> Customize --> Opportunities --> Update Reminders.


2. Click "Edit" button. Enable Update Reminder. Click "Save" button.


3. Select the users. Click "Activate" button to activate the users to receive the updates.


Use the below link to schedule the Update Reminder

http://www.infallibletechie.com/2014/07/how-to-schedule-update-reminders-in.html

Cheers!!!

July 11, 2014

How to retrieve all the Packages using Apache ANT tool in Salesforce?

Sample build.xml:

  <target name="retrieve" depends="proxy">
  <sf:retrieve
  username="${sf.sandboxusername}"
  password="${sf.sandboxpassword}"
  serverurl="${sf.sandboxurl}"
  retrieveTarget="Retrieve"
  packageNames="Package_Name"/>
 </target>

Sample package.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
  <members>*</members>
  <name>CustomObject</name>
 </types>
 <version>30.0</version>
</Package>

Cheers!!!

July 10, 2014

How to convert Integer to String in Visualforce page?


TEXT() is used to convert any data type to String in Visualforce page.

Sample Code:

Visualforce page:

<apex:page controller="SampleController" id="pag">
    <apex:form id="frm">    
        <apex:pageBlock >
            <apex:pageBlockSection rendered="{! CONTAINS(setIntegerString, TEXT(aa))}">
                <apex:pageBlockSectionItem >Name: <apex:inputText /></apex:pageBlockSectionItem>                  
            </apex:pageBlockSection>
        </apex:pageBlock> 
    </apex:form>
</apex:page>

Controller:

public class SampleController {
   Set<Integer> setInteger = new Set<Integer>{1, 3};
   public String setIntegerString {get;set;}
   public Integer aa {get;set;}
   
   public SampleController(){
       aa = 1;
       setIntegerString = '';
       for(Integer i : setInteger){
           setIntegerString += String.valueOf(i);
       }
   }    
}

Cheers!!!

How to cover Inner class in Test class for code coverage in Salesforce?

Sample Code:

Apex Class:

public class EmployeeController {
    public static void assignSequence(List<Employee__c> listEmployee, Decimal startNum) {
        Decimal initial = startNum;
        List<EmployeeWrapper> listEmployeeWrapper = new List<EmployeeWrapper>();
        
        for(Employee__c emp : listEmployee) {
            listEmployeeWrapper.add(new EmployeeWrapper(emp));
        }
        
        listEmployeeWrapper.sort();
        listEmployee.clear();
        
        for(EmployeeWrapper empW : listEmployeeWrapper) {
            listEmployee.add(empW.dirPagination);
        } 

        for(Employee__c emp : listEmployee) {                   
            emp.Sequence_in_Section__c = initial;
            initial = initial + 10;
        }        
                
        update listEmployee;
    }
    
    public class EmployeeWrapper implements Comparable {

        public Employee__c emp = new Employee__c();
        
        // Constructor
        public EmployeeWrapper(Employee__c empRecord) {
            emp = empRecord;
        }
        
        // Compare emp based on the Employee__c Age__c.
        public Integer compareTo(Object compareTo) {
            // Cast argument to EmployeeWrapper
            EmployeeWrapper compareToEmp = (EmployeeWrapper)compareTo;
            
            // The return value of 0 indicates that both elements are equal.
            Integer returnValue = 0;
            if (emp.Age__c > compareToEmp.emp.Age__c) {
                // Set return value to a positive value.
                returnValue = 1;
            } else if (emp.Directory_Heading__c < compareToEmp.emp.Age__c) {
                // Set return value to a negative value.
                returnValue = -1;
            }
            
            return returnValue;       
        }
    }
}

Test Class:

private class EmployeeControllerTest {
    static testMethod void empTest() {
        Employee__c emp = new Employee__c(Name = 'Test', Age__c = 12);
        EmployeeController.EmployeeWrapper empW = new EmployeeController.EmployeeWrapper(emp);  //Covering inner/wrapper class
        empW.compareTo(empW);  
//Covering compareTo()
    }
}