Sunday, November 3, 2013

Popup Reminders

Popup Reminders:
How to remind the users to add products for an opportunity .First create a rollup summary field that calculate how many products for an opportunity and then you can add a visualforce page with java script on your page layout like this

<apex:page standardController="Opportunity" rendered="{!Opportunity.Number_of_Products__c<1}">

<script type="text/javascript">
{

var r=confirm("please add opportunity ");
var i=0;
if (r==true&&i==0){
window.open('/p/opp/SelectSearch?addTo={!Opportunity.Id}&retURL=%2F{Opportunity.Id}','_top',false);
}else{
i=1;
}
}

</script>

</apex:page>




               


Salesforce For Outlook

Salesforce For Outlook:
Sales Managers need greater visibility into rep activities to ensure they are working effectively and to continue to build a best in class sales team.Trying to close deals quickly , sales reps rarely have a time to log activities in salesforce. Many reps depends heavily on outlook for their task, calendar and email management.





There are seven steps to set up salesforce for outlook.Administrator needs to create a separate configuration for sales reps.who will sync contacts ,events and tasks , and sales managers who only need to sync events.for this 
1. Admins must first name and activate their configuration.Remember you cannot create a custom configuration with Contact Manager or Group Edition
2.Next, admins will select which users and profiles to assign to this configuration
3.Admins will then select whether data will sync one or both ways , and define conflict behavior.
4.They can then allow users to define some data sync settings, such as whether an object will sync ,sync direction ,conflict behavior, or field mappings.
5.Finally, admins can define the data sets ,or the scope of the contact, and 
6. For the sales reps ,the event data ,and
7.The task data that will sync with salesforce.
Once these seven steps are complete ,sales reps and managers may download and use Salesforce for Outlook.



From setup menu navigate to Desktop Administration --> Outlook Configurations click new Outlook Configuration to create a configuration for sales users and mark it active.Next need to assign standard user and system admin profiles to this configuration.Notice you can also assign individual users to an outlook configuration.Next allow users to add emails to Salesforce by selecting Add Email. and define contact sync settings .Contacts should sync from both Salesforce and Outlook but records in outlook will win if there is a conflict.







Friday, October 18, 2013

Document Library

Document Library:
Imagine that you have one location to store all of your important files,such as Documents, Sales Presentations, and price lists .The Documents tab in Salesforce gives you just that.

The documents library is a place to stores files without attaching them to accounts, contacts, opportunities, or other records.Each document in the document library resides in a folder.The folders attributes determine the accessibility of the folder and the documents within it.In many organizations there are corporate folder or folders.Each can store things like price lists, company logos, and other files that could be used by any employee.







Contacts

Contacts:
Contacts are all of individuals the individuals associated with your business accounts that you need to track in Salesforce. When you convert a lead , the lead automatically becomes a  contact related to the account created for the lead. A contact can be associated to only one account, but we can associate many contacts with a single account.



There may be accounts that you work over a period of months or even years.Over the life of an account, you will likely enter a good number of contacts.One challenge is to ensure a contact you store in Salesforce stays up-to-date over the life of account .An easy and efficient way to do this is to use the Stay-in-Touch email feature. Personal-Setup-Email-My Stay-In-Touch Settings.





Track your interactions and communications with your contacts using the Activity and Activity History related list.


You can sent an email to contact






Thursday, October 17, 2013

Create or Update Contact When User Created or Updated

Create or Update Contact When User Created or Updated:
This example examples how to create a non related object records depends on dml action.

public class CONCreate

{
   @future
  public static void myMethod(Set<ID> usrids) 
  {
  
       User[] candsFromTrigger = [Select ID,Division,FirstName,LastName,Email,Department,Title,
                     Phone,MobilePhone,Street,City,State,Country,PostalCode,IsActive From User Where ID IN:usrids];
                     
        List<Contact> conList = new List<Contact>();
     
        
        
      
  
    ///candsFromTrigger = [Select ID,Division,FirstName,LastName,Email,Department,Title,
    //Phone,MobilePhone,Street,City,State,Country,PostalCode From User Where ID IN:uids];
    //TODO: Select the Recruiting record from the database and assign to an object called candAcct from the sObject Account class
     

    //Instantiate a Contact list object from the List class called conList

    
    
    //Declare a For list loop to loop through the input parameter list candsFromTrigger with an iterationvariable called currentCandidate
   
    
    
     for(User currentCandidate: candsFromTrigger){
    
    Account candAcct = [SELECT a.Id FROM Account a 
                        WHERE a.Name =:currentCandidate.Division];
      //Instantiate an object called con from the sObject class contact
      Contact con = new Contact();
      //con = [select id,FirstName,LastName,contact_status__c,Email from contact where email  =: currentCandidate.email  limit 1]; 
      //TODO: Set the attribute AccountID of the con object to the value of the Id attribute of the candAcct object
      con.AccountId = candAcct.Id;

      //Set the attribute Firstname of the con object to the value of the First_Name__c attribute of the currentCandidate object

      con.FirstName = currentCandidate.FirstName; 

      //Set the attribute Lastname of the con object to the value of the Last_Name__c attribute of the currentCandidate object

      con.LastName = currentCandidate.LastName;

      //Set the attribute Email of the con object to the value of the Email__c attribute of the currentCandidate object

      con.Email = currentCandidate.Email;
      
      con.Department = currentCandidate.Department;
      
      con.Title = currentCandidate.Title;
      
      con.Phone = currentCandidate.Phone;
      
      con.MobilePhone = currentCandidate.MobilePhone;
      
      con.MailingStreet = currentCandidate.Street;
      
      con.MailingCity = currentCandidate.City;
      
      con.MailingState = currentCandidate.State;
      
      con.MailingCountry = currentCandidate.Country;
      
      con.MailingPostalCode = currentCandidate.PostalCode;
      
      con.Contact_Type__c = 'SFC User';
      
      
      con.Contact_Status__c = 'Active';
      
      
      

      //Add the con object to the conList

      conList.add(con);    
      
       }
       insert conList;   

  }

}


public class CONUpdate { @future public static void myMethod(Set<ID> usrids) { User[] candsFromTrigger = [Select ID,Division,FirstName,LastName,Email,Department,Title, Phone,MobilePhone,Street,City,State,Country,PostalCode,IsActive From User Where ID IN:usrids]; List<Contact> conList = new List<Contact>(); List<Contact> conList1 = new List<Contact>(); ///candsFromTrigger = [Select ID,Division,FirstName,LastName,Email,Department,Title, //Phone,MobilePhone,Street,City,State,Country,PostalCode From User Where ID IN:uids]; //TODO: Select the Recruiting record from the database and assign to an object called candAcct from the sObject Account class //Instantiate a Contact list object from the List class called conList //Declare a For list loop to loop through the input parameter list candsFromTrigger with an iterationvariable called currentCandidate Contact con1; for(User currentCandidate:candsFromTrigger){ Account candAcct = [SELECT a.Id FROM Account a WHERE a.Name =:currentCandidate.Division]; //Instantiate an object called con from the sObject class contact con1 = [select id,FirstName,LastName,contact_status__c,Email from contact where email =: currentCandidate.email limit 1]; If(currentCandidate.IsActive==TRUE){ //TODO: Set the attribute AccountID of the con object to the value of the Id attribute of the candAcct object con1.AccountId = candAcct.Id; //Set the attribute Firstname of the con object to the value of the First_Name__c attribute of the currentCandidate object con1.FirstName = currentCandidate.FirstName; //Set the attribute Lastname of the con object to the value of the Last_Name__c attribute of the currentCandidate object con1.LastName = currentCandidate.LastName; con1.Department = currentCandidate.Department; con1.Title = currentCandidate.Title; con1.Phone = currentCandidate.Phone; con1.MobilePhone = currentCandidate.MobilePhone; con1.MailingStreet = currentCandidate.Street; con1.MailingCity = currentCandidate.City; con1.MailingState = currentCandidate.State; con1.MailingCountry = currentCandidate.Country; con1.MailingPostalCode = currentCandidate.PostalCode; //Set the attribute Email of the con object to the value of the Email__c attribute of the currentCandidate object // con1.Email = currentCandidate.Email; //con1.Contact_Type__c = 'SFC User'; con1.Contact_Status__c = 'Active'; //Add the con object to the conList // if(currentCandidate.IsActive==TRUE){ // con1.Contact_Status__c = 'Active';}else // If(currentCandidate.IsActive==FALSE){ // con1.Contact_Status__c='Inactive';} conList1.add(con1); System.Debug('After ADDED TO LEAD LIST VALUES *** : '+ conList1); } else if(currentCandidate.IsActive==FALSE) { con1.AccountId = candAcct.Id; //Set the attribute Firstname of the con object to the value of the First_Name__c attribute of the currentCandidate object con1.FirstName = currentCandidate.FirstName; //Set the attribute Lastname of the con object to the value of the Last_Name__c attribute of the currentCandidate object con1.LastName = currentCandidate.LastName; con1.Department = currentCandidate.Department; con1.Title = currentCandidate.Title; con1.Phone = currentCandidate.Phone; con1.MobilePhone = currentCandidate.MobilePhone; con1.MailingStreet = currentCandidate.Street; con1.MailingCity = currentCandidate.City; con1.MailingState = currentCandidate.State; con1.MailingCountry = currentCandidate.Country; con1.MailingPostalCode = currentCandidate.PostalCode; con1.Contact_Status__c='Inactive'; conList1.add(con1); System.Debug('After ADDED TO LEAD LIST VALUES *** : '+ conList1); } } //MyFutureClass.myMethod(conList1.Keyset()); update conList1; //Persist the conList to the database } }


Finally trigger looks like this

trigger CreateContact1 on User (after insert,after update) { Set<ID> uids = new Set<ID>(); for(User U : Trigger.New) { uids.add(U.ID); } if(Trigger.IsInsert) { CONCreate.myMethod(uids); } else if(Trigger.IsUpdate) { CONUpdate.myMethod(uids); } //TODO: Instantiate an object called cc from the class CreateContactFromCan //CreateContactFromCan1 cc = new CreateContactFromCan1(); //TODO: Inovke the method createContact and send a List of Candidates as an input parameter //cc.createContact1(uids); //CreateContactFromCan1.createContact1(uids); }

and test class is

@isTest private class TestTriggersCreateContactFromCan1 { static testMethod void TestCreateContactFromCan1() { account acc=new account(Name='CCS',Region__c='10',Industry='Aero'); insert acc; User u =new User(FirstName = 'TestFirstName' , TimeZoneSidKey='America/Los_Angeles',LocaleSidKey='en_US', EmailEncodingKey='ISO-8859-1', ProfileId='00e30000001YGorAAG',LanguageLocaleKey='en_US' , LastName = 'TestLastName', Alias = 'Test789' , Email = 'Test789@gmail.com' , UserName = 'Test559@gmail.com',CommunityNickname = 'TestNickName', Division='CCS'); try{ insert u; }catch (exception e){ system.debug('exception:'+e); } u.LastName='Final456'; try{ update u; }catch(exception e){ system.debug('exception:'+e); } u.IsActive=False; try{ update u; }catch(exception e){ system.debug('exception:'+e); } } }





Accounts

Accounts:
When a lead is converted you can create account, contact and potentially an opportunity.
Accounts are key to building and accessing all your customer-related data.
Accounts are the backbone of information that represent prospective, existing and former customers.Each account stores information, such as name, address and phone numbers.

For each account, you can store related information  such as an opportunities, activities, cases, partners, contacts and notes.
You can also sort and filter your accounts using standard and custom list views.
Open Activities : You can track items, such as tasks, events, and emails, in both the open activities and activity history related lists.Open activities related list include all Open Tasks, Open Events.
Activity History related list includes completed tasks, logged phone calls, expired events, logged emails, merged documents.The Notes and Attachments related list contains account related files and file size limit is 5 MB.The contacts related list includes contact information for all contacts associated with the record.The contact roles related list displays contact information for individuals who are not directly linked to an account.