• Gattam Rakesh (SFDC)
  • NEWBIE
  • 15 Points
  • Member since 2014
  • Sfdc Developer

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 16
    Replies
Hi All i have a requirement like this an lead should be created once the lead created a contact should be created and lead should be deleted
1st part is working fine and for second part: 
if we have exisitng contact with same email and an email should be sent for the user and it should be updates with exisitng contact
Can any one help with this :
Please see my code below :
trigger CreateContactTest on Lead (After Insert) 
{
//Map<string,Id> mapaddress = New Map<String,Id>();
List<Lead> toDelete =New List<Lead>();
Set<string> Email= new Set<string>();
List<Contact>Contacts=[Select Id,Email from Contact Where Email=:Email];
 List <Contact>Con= new List<Contact>();
 
 For( Lead LD:Trigger.new)
 { 

 Contact cc = New Contact();
 cc.FirstName= LD.FirstName;
 cc.LastName=LD.LastName;
// cc.Name=LD.Name;
 cc.Salutation=LD.Salutation;
 cc.Email=LD.Email;
 cc.Title=LD.Title;
 cc.Phone=LD.Phone;
 
 Con.add(cc);
 Todelete.Add(LD);
 
  
 }
 insert con;
 if(todelete.size()>0)
 Delete [Select ID from lead where Id In:ToDelete];
 }
Hi All

 I have an issue with Translation i can see one field on Account Page layout which spelt wrongly in Italian language can any one help me out how can we change it ? Do we need to Raise a case for Salesforce or we can directly change it?

Thanks
global class Inactiveuser implements Database.Batchable<sObject>
{
    global Database.QueryLocator start(Database.BatchableContext BC)
    {
        String query = 'SELECT Id,Name,Isactive From User WHERE Isactive=TRUE';
        return Database.getQueryLocator(query);
        
    }
    
     global void execute(Database.BatchableContext BC, List<user> scope)
    {
        for(user a : scope)
         {
           if(a.LastLoginDate> )
           
          {
          
          
          
          } 

         }
         update scope;
    }   
    global void finish(Database.BatchableContext BC)
    {
    }
}
Hai all I have two Fields Start date and End Date if Start Date and End date lies Between Total status Should be updated to Active
How to Do it?
Thanks In Advance
Hai all
          can any one explain me how to populate a vf page from a vf page for example i have two pages page1 and page2 in page1 we will be having one button open Page2 by clicking that page2 should populate in page1 
 Thanks in advance
Hai  all can any one tell me how to write test class for select list and select option?
Hai all 
Can any one Explain me how to create a same task on the Other Custom Object automatically??
Here is my Requirement 
I have one custom Object Retailer__c and custom Button on Retailer Object Take Order once we click on it A task should be created on retailer and same task should be created on Account for me now task is creating on both account and retailer but fileds are not mapping can any 1 help me out here is my code:
  Public PageReference Save()
        {
         odd.Distributor__c=acc.Id;
         odd.Retailer__c=ret.id;
         Insert odd;
        task1.Subject='Order/Visit' ;
        task1.Status__c='Order Taken';
        task1.Whatid=ret.id;
        task1.Date__c=odd.Order_Date__c;
        task1.Comments__c=ret.Comments__c;
        task1.Country__c=ret.Billing_Country__c;
        task1.State__c= ret.Billing_State__c;
        task1.City__c=ret.Billing_City__c;
        task1.Street__c=ret.Billing_Street__c;
        task1.Zip_Postal_Code__c=ret.Billing_Zip_Postal_Code__c;
        task1.Province__c=ret.Billing_Province__c;
        Insert task1;
        task2.Whatid=acc.id;
        
        Insert task2;
 
Hai all
Can any one tell me how to use java script in visual force page by using static resources 
Hello all ,
Can any one tell me how to override a standard button with popup message
for example if the user click on new button in Account Page he need to get a popup message "Sorry you account create a new Account"
 
I have a Bulit a visual Force page I have Got all the contact list by using recordsetVar now my requirment is when i scroll down the header should be Freezed it means it should not move all the records should move down when we scroll here is my code

<apex:page standardController="Contact" recordSetVar="contacts" >
<apex:form >
 <apex:pageBlock title="Contacts List">
 <apex:outputPanel layout="block" style="overflow:auto;width:750px;height:250px" >
 <style>

    </style>
<apex:pageBlockTable value="{! contacts }" var="Contact1">
            <apex:column value="{! Contact1.FirstName }" />
            <apex:column value="{! Contact1.LastName }"/>
            <apex:column value="{! Contact1.Email }"/>
            <apex:column value="{! Contact1.Account.Name }"/>
            <apex:column headerValue="Phone">
    <apex:inputText value="{!Contact1.Phone}" size="10"/>
            </apex:column>
            </apex:pageBlockTable>
       </apex:outputPanel>
         </apex:pageBlock>
        </apex:form>
</apex:page>
 
public with sharing class CaseEmailClass
{   Public Contact cc{get;set;} 
    Public list<Contact> cn{get;set;}
    public String Comment { get; set; }
    public String Emailid { get; set; }
    public String ContactNo { get; set; }
    public String Name { get; set; }
    public PageReference submit() 
   {
   cn=[SELECT Id,Email FROM Contact];
   if(cn.Email==EmailId)
   {
    Case c=new Case();
            c.Status='New';
            c.ContactId=cn.id;
            c.Priority='High';
            c.Description=Comment;
            c.Subject='A New Case Has Been Rasied';
           insert c;
           }
  
   List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
      Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
      mail.setToAddresses(new String[] {'mail2gattam@gmail.com'});
       mail.setSubject('A New Case Has Been Raised');
     String table = '';
      String body='';
        /*     table=table+'Name:'+Name+'<br/>'; 
             table=table+'ContactNo:'+ContactNo+'<br/>';
             table=table+'Email Id:'+Emailid+'<br/>';
             table=table+'Comment:'+Comment+'<br/>'; */
          table = table + '<b><table  align="center" width="50%"  border: 1px solid black;>'; 
                  table = table + '<tr>';
                  table = table + '<td width="25%" align="center"><b>Name:&nbsp;&nbsp;</b>'+Name+'</td>'; 
                  table = table + '</tr>';
                  table = table + '<tr>';
                  table = table + '<td width="25%" align="center"><b>ContactNo:&nbsp;&nbsp;&nbsp;</b>'+ContactNo+'</td>'; 
                  table = table + '</tr>';
                  table = table + '<tr>';
                 table = table + '<td width="25%" align="center"><b>Email Id:&nbsp;&nbsp;&nbsp;</b>'+Emailid+'</td>';
                 table = table + '</tr>';
                 table = table + '<tr>';
                  table = table + '<td width="25%" align="center"><b>Comment:&nbsp;&nbsp;&nbsp;&nbsp;</b>'+Comment+'</td>'; 
                   table = table + '</tr>';
              body=table;
        mail.setHTMLbody(body);      
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });   
       // return null;
          Contact con= New Contact();
          con.LastName=Name;
          con.MobilePhone=ContactNo;
          con.Email=EmailId;
        insert con;
            Case c=new Case();
            c.Status='New';
            c.ContactId=con.id;
            c.Priority='High';
            c.Description=Comment;
            c.Subject='A New Case Has Been Rasied';
           insert c;
         return null;
   }
    }
Hai all I have two Fields Start date and End Date if Start Date and End date lies Between Total status Should be updated to Active
How to Do it?
Thanks In Advance
I am try to change the positon of input text fields dynamically.i.e city3 in first position .
<apex:inputText value="{!city1}" />
<apex:inputText value="{!city2}" />
<apex:inputText value="{!city3}" />

 
Hai  all can any one tell me how to write test class for select list and select option?
Hello all ,
Can any one tell me how to override a standard button with popup message
for example if the user click on new button in Account Page he need to get a popup message "Sorry you account create a new Account"
 
I have a Bulit a visual Force page I have Got all the contact list by using recordsetVar now my requirment is when i scroll down the header should be Freezed it means it should not move all the records should move down when we scroll here is my code

<apex:page standardController="Contact" recordSetVar="contacts" >
<apex:form >
 <apex:pageBlock title="Contacts List">
 <apex:outputPanel layout="block" style="overflow:auto;width:750px;height:250px" >
 <style>

    </style>
<apex:pageBlockTable value="{! contacts }" var="Contact1">
            <apex:column value="{! Contact1.FirstName }" />
            <apex:column value="{! Contact1.LastName }"/>
            <apex:column value="{! Contact1.Email }"/>
            <apex:column value="{! Contact1.Account.Name }"/>
            <apex:column headerValue="Phone">
    <apex:inputText value="{!Contact1.Phone}" size="10"/>
            </apex:column>
            </apex:pageBlockTable>
       </apex:outputPanel>
         </apex:pageBlock>
        </apex:form>
</apex:page>
 
public with sharing class CaseEmailClass
{   Public Contact cc{get;set;} 
    Public list<Contact> cn{get;set;}
    public String Comment { get; set; }
    public String Emailid { get; set; }
    public String ContactNo { get; set; }
    public String Name { get; set; }
    public PageReference submit() 
   {
   cn=[SELECT Id,Email FROM Contact];
   if(cn.Email==EmailId)
   {
    Case c=new Case();
            c.Status='New';
            c.ContactId=cn.id;
            c.Priority='High';
            c.Description=Comment;
            c.Subject='A New Case Has Been Rasied';
           insert c;
           }
  
   List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
      Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
      mail.setToAddresses(new String[] {'mail2gattam@gmail.com'});
       mail.setSubject('A New Case Has Been Raised');
     String table = '';
      String body='';
        /*     table=table+'Name:'+Name+'<br/>'; 
             table=table+'ContactNo:'+ContactNo+'<br/>';
             table=table+'Email Id:'+Emailid+'<br/>';
             table=table+'Comment:'+Comment+'<br/>'; */
          table = table + '<b><table  align="center" width="50%"  border: 1px solid black;>'; 
                  table = table + '<tr>';
                  table = table + '<td width="25%" align="center"><b>Name:&nbsp;&nbsp;</b>'+Name+'</td>'; 
                  table = table + '</tr>';
                  table = table + '<tr>';
                  table = table + '<td width="25%" align="center"><b>ContactNo:&nbsp;&nbsp;&nbsp;</b>'+ContactNo+'</td>'; 
                  table = table + '</tr>';
                  table = table + '<tr>';
                 table = table + '<td width="25%" align="center"><b>Email Id:&nbsp;&nbsp;&nbsp;</b>'+Emailid+'</td>';
                 table = table + '</tr>';
                 table = table + '<tr>';
                  table = table + '<td width="25%" align="center"><b>Comment:&nbsp;&nbsp;&nbsp;&nbsp;</b>'+Comment+'</td>'; 
                   table = table + '</tr>';
              body=table;
        mail.setHTMLbody(body);      
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });   
       // return null;
          Contact con= New Contact();
          con.LastName=Name;
          con.MobilePhone=ContactNo;
          con.Email=EmailId;
        insert con;
            Case c=new Case();
            c.Status='New';
            c.ContactId=con.id;
            c.Priority='High';
            c.Description=Comment;
            c.Subject='A New Case Has Been Rasied';
           insert c;
         return null;
   }
    }