• PlatFormCloud
  • NEWBIE
  • 40 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 10
    Replies
I was reading the APEX guide provided by Salesforce. Can someone please elaborate the rationale (System.assert) of the below code:
 


String s;
System.assert('a' == 'A');
System.assert(s < 'b');
System.assert(!(s > 'b'));
Thanks!
 
Hi Experts,
What is the difference between Clone () and DeepClone() in Apex? When should we use what? Can someone explain with an example?

Thanks!
I want to retrieve the list of users who have conflicts in their appointments i.e. the users have more than 2 appointments(Events) at a same time. Is it possible through SOQL query?

Or we have to write any custom code for this requirement?

Thanks!
 
Hi,
By reading the SalesForce documentation, I did understand to write a best SOQL query we need to write  Selective SOQL query  and need to use of INDEXING  in Field. 

My questions are: 
1. What is basically mean by "INDEXING" on a field?
2. In the documentation - below statement is written-

SELECT Id FROM Account WHERE Id IN (<list of account IDs>)
The WHERE clause is on an indexed field (Id). If SELECT COUNT() FROM Account WHERE Id IN (<list of account IDs>)returns fewer records than the selectivity threshold, the index on Id is used. 


What do we mean by : selectivity threshold ?   Please explain.

Thanks!

Hi Experts,
I have a functionality, where I donot want users to provide duplicate Email associated with Account. The below triggers works perfectly. If there ate 100K Account records are present in the SalesForce System, then will the below triggers work?
 
/* Preventing users creation of duplicate in Salesforce*/
trigger PreventDuplicateNameAccount on Account (before insert, before update) {


       //Preparing Account names in Set from trigger.new

        Set<String> nameSet = new Set<String>();

        for(Account acc : trigger.new){

            nameSet.add(acc.Email__c);        

        }

        // getting the list of accounts in database  with the account name we entered ( trigger.new)

        List<Account> accList = new List<Account>(
            [select id,name, Email__c from Account where Email__c in: nameSet]);

        for(Account a : trigger.new){

            if(accList.size() > 0 )
                a.addError('Accounts Email already exists in your Organization with Email '+a.Email__c);

        }
}

 
Hi saleForce Experts,
I have a trigger on Contact. I hahe functionality to update the number of contacts in Account. I have a field in Account as "No_of_Associated_Contacts__c". Below is the trigger. 
Please help me Where I am doing wrong?

trigger NumberOfContacts on Contact (after insert, after undelete) {
  Set<Id> accountIds = new Set<Id>();
    for(Contact c:trigger.new){
         accountIds.add(c.Id);
        }
    List<Account> accLst = [SELECT ID, No_of_Associated_Contacts__c FROM Account where Id IN:accountIds];
    List<Contact> con = [SELECT Id FROM Contact WHERE Accountid IN:accountIds];
    
  for(Account a: accLst){
      a.No_of_Associated_Contacts__c = con.size();
      System.debug('Number Of Associated Contacts' + a.No_of_Associated_Contacts__c);
      System.debug('Number Contact Size' + con.size());

      
  }
   update accLst;
}
What do we mean by Script Statement in Apex? How can we find, howmuch did we have consumed? And what is the best ways to overcome this limit?
Hi experts,
Very basic question and find difficult to understand. And please let me know, when to use what?

What is the difference between these 2 coding structures:
1.  public String name {
         get { return name;}
        set { name = value;}

2. public String name{get;set;}
I want to show the Start Date and End Date in user's Local time Zone. For this I have created a Visual Force Page and through getter and setter method, when I am showing IN VF Page,I am getting the time in GMT. What is the way for the the logged-in user to show the local time in Visual force Page?
 
Hi, 
I saved the trigger sucessully, however, when I am saving  the BLC_Lead__c record from UI, then I am getting the error in the bold font written line and the error is  Salesforce - Unlimited EditionSystem.NullPointerException: Attempt to de-reference a null object: Trigger.EnableCurfewedOnLeads: line 23, column 1 :


trigger EnableCurfewedOnLeads on BLC_Lead__c (before update) {

//Iterate over all the Leads to retrieve the Curfew ID
   Set<Id> setCurfewIds = new Set<Id>();
     for(BLC_Lead__c blcLead : Trigger.new){
     
       setCurfewIds.add(blcLead.Call_Curfew_Details__r.id);      
       
        }
        

//  Retrieve all Curfews and create a map of Curfews

  Map<Id,Call_Curfew_Details__c>  mapCurfews = new Map<Id,Call_Curfew_Details__c>([SELECT Id, IsCurfew__c FROM Call_Curfew_Details__c where Id IN:setCurfewIds]);
  
    
    
//Iterate all over the Leads and Populate the flag isCurfew = TRUE
    for(BLC_Lead__c leds: Trigger.new){
    
if(leds != null && leds != null){        
         Call_Curfew_Details__c relatedCurfews =  mapCurfews.get(leds.Call_Curfew_Details__r.id);          leds.IsCurfew__c =  relatedCurfews.IsCurfew__c;        
          }        
       }    

    }
One of the Apex Governor limit is:

Total number of SOQL queries issued1 (This limit doesn’t apply to custom metadata types. In a single Apex transaction, custom metadata records can have unlimited SOQL queries.)

What does this statement means- In a single Apex transaction, custom metadata records can have unlimited SOQL queries.

Can some one give examples?
Can we able to see the debug ststement if we write System.Debug within a Constructor?
Hi Experts,
What is the difference between Clone () and DeepClone() in Apex? When should we use what? Can someone explain with an example?

Thanks!
Hi experts,
Very basic question and find difficult to understand. And please let me know, when to use what?

What is the difference between these 2 coding structures:
1.  public String name {
         get { return name;}
        set { name = value;}

2. public String name{get;set;}
I was reading the APEX guide provided by Salesforce. Can someone please elaborate the rationale (System.assert) of the below code:
 


String s;
System.assert('a' == 'A');
System.assert(s < 'b');
System.assert(!(s > 'b'));
Thanks!
 
Hi Experts,
What is the difference between Clone () and DeepClone() in Apex? When should we use what? Can someone explain with an example?

Thanks!

Hi Experts,
I have a functionality, where I donot want users to provide duplicate Email associated with Account. The below triggers works perfectly. If there ate 100K Account records are present in the SalesForce System, then will the below triggers work?
 
/* Preventing users creation of duplicate in Salesforce*/
trigger PreventDuplicateNameAccount on Account (before insert, before update) {


       //Preparing Account names in Set from trigger.new

        Set<String> nameSet = new Set<String>();

        for(Account acc : trigger.new){

            nameSet.add(acc.Email__c);        

        }

        // getting the list of accounts in database  with the account name we entered ( trigger.new)

        List<Account> accList = new List<Account>(
            [select id,name, Email__c from Account where Email__c in: nameSet]);

        for(Account a : trigger.new){

            if(accList.size() > 0 )
                a.addError('Accounts Email already exists in your Organization with Email '+a.Email__c);

        }
}

 
Hi saleForce Experts,
I have a trigger on Contact. I hahe functionality to update the number of contacts in Account. I have a field in Account as "No_of_Associated_Contacts__c". Below is the trigger. 
Please help me Where I am doing wrong?

trigger NumberOfContacts on Contact (after insert, after undelete) {
  Set<Id> accountIds = new Set<Id>();
    for(Contact c:trigger.new){
         accountIds.add(c.Id);
        }
    List<Account> accLst = [SELECT ID, No_of_Associated_Contacts__c FROM Account where Id IN:accountIds];
    List<Contact> con = [SELECT Id FROM Contact WHERE Accountid IN:accountIds];
    
  for(Account a: accLst){
      a.No_of_Associated_Contacts__c = con.size();
      System.debug('Number Of Associated Contacts' + a.No_of_Associated_Contacts__c);
      System.debug('Number Contact Size' + con.size());

      
  }
   update accLst;
}
Hi experts,
Very basic question and find difficult to understand. And please let me know, when to use what?

What is the difference between these 2 coding structures:
1.  public String name {
         get { return name;}
        set { name = value;}

2. public String name{get;set;}
I want to show the Start Date and End Date in user's Local time Zone. For this I have created a Visual Force Page and through getter and setter method, when I am showing IN VF Page,I am getting the time in GMT. What is the way for the the logged-in user to show the local time in Visual force Page?
 
Hi,

Please any one can explain me about apex:repeat component in salesforce? where we can use?

regards,
Sain
  • August 11, 2015
  • Like
  • 0