• karunakarreddy bade 8
  • NEWBIE
  • 51 Points
  • Member since 2015

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 4
    Questions
  • 23
    Replies
Hi
  What is the difference between <apex:pageblock buttons> and <apex:commandbuttons> in salesforce.


Thanks&Regards
Ranga
Hi all

When I am execute this Trigger I am getting an error : Variable does not exist: l.id at line 38 column 43

Trigger updateleadstatus on Task(after insert,after update,after delete,after undelete)
{
    public set<id>setids=new Set<Id>();
    public List<Lead>LeadToBeChanged=new List<Lead>();
    
    
    If(Trigger.isinsert || Trigger.Isupdate  ||Trigger.Isundelete)
    {
    
       for(task t:trigger.new)
       {
       
          if(string.valueof(t.whoid).startswith('00Q'))
          
          setids.add('t.whoid');
    }
    }
    
    
       If( Trigger.Isdelete )
    {
    
       for(task t:trigger.old)
       {
       
          if(string.valueof(t.whoid).startswith('00Q'))
          
          setids.add('t.whoid');
       }
    }
    
    
    If(setids.size()>0)
       {
       
         for(Lead l :[select l.id, l.task_Count__c,(select id from tasks where isclosed=false) from Lead l where id in:setids]);
          {
          LeadToBeChanged.add(new Lead(id=l.id,task_Count__c = l.tasks.size()));
           
       
       update LeadToBeChanged; 
       }}
    
    
   }

 
When I am execute this Trigger I am getting an error at line Query Illegal assignment from LIST<Account> to LIST<Account> at line in Salesforce Trigger


trigger ContactsOnAccount on Contact (after insert, after delete) {
    Set<Id> aId = new Set<Id>();
   
    if(Trigger.isInsert){
        for(Contact opp : Trigger.New){
            aId.add(opp.AccountId);
        }
        List<Account> acc = [select id,Count_id__c from Account where Id in:aId];
        List<Contact> con = [select id from contact where AccountId in :aId];
       
        for(Account a : acc){
            a.Count_id__c=con.size();
           
        }update acc;
    }
   
    if(Trigger.isDelete){
        for(Contact opp : Trigger.old){
            aId.add(opp.AccountId);
        }
        List<Account> acc = [select id,Count_id__c from Account where Id in:aId];
        List<Contact> con = [select id from contact where AccountId in :aId];
       
        for(Account a : acc){
            a.Count_id__c=con.size();
           
        }update acc;
    }
 
}
  
   
       
Hi Friends,

I am facing an Issue Regarding production that is

When I refresh the production then the content will be copied in Full copy sandbox right at the same time masking emails are sent to all users
in the invalid format for example: actuval mail id is krishna@hp.com but it will send in the format like kri=shna@example.com like that it will send but my requirement is we want send the valid emails to users when we refresh the production

Please give me the your valubale comments

Thanks
 

Hi All,
   Please tell me what is the difference between NAME and NAMESPACE in VF PAGE.

Thanks
B.Karunakar
 
Hi all

When I am execute this Trigger I am getting an error : Variable does not exist: l.id at line 38 column 43

Trigger updateleadstatus on Task(after insert,after update,after delete,after undelete)
{
    public set<id>setids=new Set<Id>();
    public List<Lead>LeadToBeChanged=new List<Lead>();
    
    
    If(Trigger.isinsert || Trigger.Isupdate  ||Trigger.Isundelete)
    {
    
       for(task t:trigger.new)
       {
       
          if(string.valueof(t.whoid).startswith('00Q'))
          
          setids.add('t.whoid');
    }
    }
    
    
       If( Trigger.Isdelete )
    {
    
       for(task t:trigger.old)
       {
       
          if(string.valueof(t.whoid).startswith('00Q'))
          
          setids.add('t.whoid');
       }
    }
    
    
    If(setids.size()>0)
       {
       
         for(Lead l :[select l.id, l.task_Count__c,(select id from tasks where isclosed=false) from Lead l where id in:setids]);
          {
          LeadToBeChanged.add(new Lead(id=l.id,task_Count__c = l.tasks.size()));
           
       
       update LeadToBeChanged; 
       }}
    
    
   }

 
When I am execute this Trigger I am getting an error at line Query Illegal assignment from LIST<Account> to LIST<Account> at line in Salesforce Trigger


trigger ContactsOnAccount on Contact (after insert, after delete) {
    Set<Id> aId = new Set<Id>();
   
    if(Trigger.isInsert){
        for(Contact opp : Trigger.New){
            aId.add(opp.AccountId);
        }
        List<Account> acc = [select id,Count_id__c from Account where Id in:aId];
        List<Contact> con = [select id from contact where AccountId in :aId];
       
        for(Account a : acc){
            a.Count_id__c=con.size();
           
        }update acc;
    }
   
    if(Trigger.isDelete){
        for(Contact opp : Trigger.old){
            aId.add(opp.AccountId);
        }
        List<Account> acc = [select id,Count_id__c from Account where Id in:aId];
        List<Contact> con = [select id from contact where AccountId in :aId];
       
        for(Account a : acc){
            a.Count_id__c=con.size();
           
        }update acc;
    }
 
}
  
   
       
Hi Friends,

I am facing an Issue Regarding production that is

When I refresh the production then the content will be copied in Full copy sandbox right at the same time masking emails are sent to all users
in the invalid format for example: actuval mail id is krishna@hp.com but it will send in the format like kri=shna@example.com like that it will send but my requirement is we want send the valid emails to users when we refresh the production

Please give me the your valubale comments

Thanks
 
Hi
  What is the difference between <apex:pageblock buttons> and <apex:commandbuttons> in salesforce.


Thanks&Regards
Ranga
I have created a table with pageblocktable to display a custom object fields on  VF page, I have created a column of checkbox in the same table. I want to select the record through these checkbox and want to insert the selected record in another object having same fiields.

Thanks!
I am trying to write a custom formula field. I am trying

IF(
NOT(
ISPICKVAL( Picklist_Item__r.Type  = "Individual"),
Desired_Output__c,
Else_Desired_Output__c
))

The error I'm getting is that a ) is missing but it highlights a ,

Thanks!
What is fusion chart
Hi All,

i have a custom page in that i want to display data in table. In that table, some data display with some color and it comes from controller.User-added image
in VF page, i put it like this 
<td style="background-color:{!w.EnglishColor}">
SocialColor came from controller. its working fine.

But now i want to use style class at <td>. and that color needs to come from controller. 
How should i acheave this problem using CSS. Because need CSS file that i put in static Resources.
Please help me any one using CSS only.

I appriciate your response.


Thank you.
Rakesh.S

 
Hello everyone, plz tell me how to write the test class for this trigger listed below..
trigger ConTest on Account(after insert,after Update)
{
 if(trigger.isInsert && trigger.isAfter)
 {
  List<Contact> lstCon = new List<Contact>();
  for(Account acc : trigger.new)
  {
   Contact con = new Contact();
   con.lastName=acc.Name;
   con.AccountId = acc.Id;
   lstCon.add(con);
  }
  insert(lstCon);
 }
 
 if(trigger.isUpdate && trigger.isAfter)
 {
  Map<Id,Account> mapACC = new Map<Id,Account>([select (select id,name from contacts) from account where id IN: trigger.new]);
  List<Contact> newCon = new List<Contact>();
  for(Account updatedAcc : trigger.New)
  {
   Account oldAcc = trigger.oldMap.get(updatedAcc.Id);
   if(mapACC.ContainsKEY(updatedAcc.Id) && oldAcc.Name != updatedAcc.Name)
   {
 for(Contact con : mapACC.get(updatedAcc.Id).contacts)
    {
     con.lastname = updatedAcc.Name;
     newCon.add(con);
    }
   }
  }
  update newCon;
 }
} 

Thanks in advance :)
trigger trgCreateExpenseOnEventCompletion on Event (before insert, before update)
{
    Set<Id> setOwnerId = new Set<Id>();
    Set<Date> setNewDates = new Set<Date>();
    Set<Date> setExistingDates = new Set<Date>();
    
    List<Expense__c> lstExpense = new List<Expense__c>();
    
    if(Trigger.isBefore && Trigger.isInsert)
    {
        for(Event objEvent : Trigger.New)
        {
            if(objEvent.StartDateTime != Null)
            {
                setNewDates.add(objEvent.StartDateTime.Date());
                setOwnerId.add(objEvent.OwnerId);
            }
        }
        
        if(setNewDates != Null && setNewDates.size() > 0)
        {
            List<Event> lstTempEvent = [select Id, ActivityDate from Event where IsAllDayEvent = true AND ActivityDate IN : setNewDates AND OwnerId IN : setOwnerId AND Subject = 'Out Of Office' AND Status__c != 'Deferred' LIMIT 1];
            
            system.debug('test' + lstTempEvent);
            
            if(lstTempEvent != Null && lstTempEvent.size() > 0)
            {
                for(Event objEvent : lstTempEvent)
                {
                    setExistingDates.add(objEvent.ActivityDate);
                }
            }
        }
    }

    for(Event objEvent : Trigger.New)
    {
        if(setExistingDates.size() > 0 && setExistingDates.contains(objEvent.StartDateTime.Date()))
        {
            objEvent.addError('Sorry! You cant create an event for this date as you are on leave...');
        }
        else
        {
            String AccountId = '';
            
            if(objEvent.WhatId != Null)
            {
                AccountId = objEvent.WhatId;
            }
            
            if( objEvent.Status__c == 'Completed' && objEvent.Expense_Created__c != true && objEvent.Subject != 'Phone Call' && objEvent.Total_Expense__c > 0)
            {
                List<Sales_Representative__c> lstSalesRep = [select Id from Sales_Representative__c where Representative_Name__c =: objEvent.OwnerId];
                
                if(lstSalesRep.size() > 0)
                {
                    objEvent.Expense_Created__c = true;
                    
                    RecordType objRT = [select Id from RecordType where Name = 'Auto Created'];
                    
                    Expense__c objExpense = new Expense__c();
                    
                    objExpense.Activity_Performed__c = objEvent.Subject;
                    objExpense.Activity_Status__c = objEvent.Status__c;
                    objExpense.Entertainment_Expense__c = objEvent.Entertainment_Expense__c;
                    if(objEvent.End_DateTime__c != Null)
                    {
                        objExpense.Expense_Date__c = objEvent.End_DateTime__c.Date();
                    }
                    else
                    {
                        objExpense.Expense_Date__c = objEvent.EndDateTime.Date();
                    }
                    objExpense.Expense_Status__c = 'Created';
                    objExpense.Other_Expense__c = objEvent.Other_Expense__c;
                    objExpense.Parking_Expense__c = objEvent.Parking_Expense__c;
                    
                    objExpense.Sales_Representative__c = lstSalesRep[0].Id;
                    objExpense.Toll_Expense__c = objEvent.Toll_Expense__c;
                    objExpense.Total_Travel_Expense__c = objEvent.Total_Travel_Expense__c;
                    objExpense.RecordTypeId = objRT.Id;
                    
                    lstExpense.add(objExpense);
                }
            }
        }
    }
    
    if(lstExpense.size() > 0)
    {
        insert lstExpense;
    }
    
    if(Trigger.isBefore && Trigger.isUpdate)
    {
        for(Event objEvent : Trigger.New)
        {
            String AccountId = '';
        
            if(objEvent.WhatId != Null)
            {
                AccountId = objEvent.WhatId;
            }
            
            if(AccountId != '' &&  AccountId.substring(0,3) == '001' &&  objEvent.Status__c == 'Deferred' && Trigger.oldMap.get(objEvent.Id).Status__c != 'Deferred')
            {
                if(objEvent.Owner_Manager_Email__c != Null)
                {
                    try
                    {
                        Account objAccount = [select Id, Name from Account where Id =: AccountId];
                                         
                        List<String> toAddress = new List<String>();
                        List<String> bccAddress = new List<String>();
                                        
                        toAddress.add(objEvent.Owner_Manager_Email__c);   
                        //toAddress.add('ashish.jain@saasfocus.com');  
                        bccAddress.add('ashish.jain@saasfocus.com');
                            
                        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                        mail.setToAddresses(toAddress);
                        mail.setBccAddresses(bccAddress);
                        
                        mail.setSubject('Activity Deferred');
                            
                        string strBody = '<br/><font style=\"font-family:arial; font-size:16px;\"> <br/><br/><br/>An activity has been deferred by ' + objEvent.Owner_Name__c + '.<br/><br>Following are the details of the activity : </font><br/><br/><br/>';
                        
                        strBody += '<b>Dealer Name - </b>' + objAccount.Name + '<br/><br/><b>Start DateTime - </b>' + objEvent.StartDateTime + '<br/><br/><b>End DateTime - </b>' + objEvent.EndDateTime + '<br/><br/>';
                        
                        strBody +=  '<br/><br/><b>Start DateTime - </b>' + objEvent.StartDateTime + '<br/><br/><b>End DateTime - </b>' + objEvent.EndDateTime + '<br/><br/>';
                        
                        strBody += '<a href=\"https://cs6.salesforce.com/' + objEvent.Id + '\" >Click to open the activity</a>';
                        strBody += '<br/><br/><br/>Thanks<br/><br/>Falken Tyres';
                        
                        mail.setHtmlBody(strBody);
                            
                        Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
                        
                    }
                    catch(Exception e)
                    {
                    }
                }
            }
            else if(AccountId != '' && AccountId.substring(0,3) != '001' && objEvent.Status__c == 'Deferred' && Trigger.oldMap.get(objEvent.Id).Status__c != 'Deferred')
            {
                if(objEvent.Owner_Manager_Email__c != Null)
                {
                    try
                    {
                        List<String> toAddress = new List<String>();
                        List<String> bccAddress = new List<String>();
                                        
                        toAddress.add(objEvent.Owner_Manager_Email__c);   
                        //toAddress.add('ashish.jain@saasfocus.com');  
                        bccAddress.add('ashish.jain@saasfocus.com');
                            
                        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                        mail.setToAddresses(toAddress);
                        mail.setBccAddresses(bccAddress);
                        
                        mail.setSubject('Activity Deferred');
                            
                        string strBody = '<br/><font style=\"font-family:arial; font-size:16px;\"> <br/><br/><br/>An activity has been deferred by ' + objEvent.Owner_Name__c + '.<br/><br>Following are the details of the activity : </font><br/><br/><br/>';
                        
                        strBody +=  '<br/><br/><b>Start DateTime - </b>' + objEvent.StartDateTime + '<br/><br/><b>End DateTime - </b>' + objEvent.EndDateTime + '<br/><br/>';
                        strBody += '<a href=\"https://cs6.salesforce.com/' + objEvent.Id + '\" >Click to open the activity</a>';
                        strBody += '<br/><br/><br/>Thanks<br/><br/>Falken Tyres';
                        
                        mail.setHtmlBody(strBody);
                            
                        Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
                        
                    }
                    catch(Exception e)
                    {
                    }
                }
           }
       }
    }
}
Hi,

How to update a picklist feild based on the the picklist value and modified date. Please assume that i have piclist feild named as stage. If the stage is "Qualification" and the modified date is one day before it should automatically update the picklist field as "closed". How to get this ? please some one help me. I am new to salesforce.
I have a requirement as below:
I need to generate a report which shows::: List of sales users with no activity OR no Opportunity update in last 7 days 

I have an apex class with the above functionality...


Is there any way that I can use this Apex class to generate the report..??
Hi All,

I have knowledge of different salesforce object relationships but can anyone give me better understanding with practical example among these different relationships. I might be wrong but I think we can also create junction object with lookup or master-detail but when should I use lookup and when should I use Master detail junction object? 
  1. Lookup
  2. Master-Detail
  3. Self (Hierarchical)
  4. Junction object using Lookup
  5. Junction object using Master-Detail.
Hello,

How is it possible to calculate distance between two points given the lattitude and longitude.
Also, are there other geolocalization apps i can have a look

Thanks
 
  • October 01, 2015
  • Like
  • 2