-
ChatterFeed
-
0Best Answers
-
2Likes Received
-
0Likes Given
-
12Questions
-
10Replies
System.Assert
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!
-
- PlatFormCloud
- August 09, 2016
- Like
- 0
- Continue reading or reply
Clone and DeepClone
Hi Experts,
What is the difference between Clone () and DeepClone() in Apex? When should we use what? Can someone explain with an example?
Thanks!
What is the difference between Clone () and DeepClone() in Apex? When should we use what? Can someone explain with an example?
Thanks!
-
- PlatFormCloud
- June 03, 2016
- Like
- 1
- Continue reading or reply
SOQL query or Coding required?
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!
Or we have to write any custom code for this requirement?
Thanks!
-
- PlatFormCloud
- June 02, 2016
- Like
- 0
- Continue reading or reply
Query on Custom Indexing
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!
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!
-
- PlatFormCloud
- May 29, 2016
- Like
- 0
- Continue reading or reply
Apex Trigger: Need the Best solution, which can work for 100K records
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); } }
-
- PlatFormCloud
- May 28, 2016
- Like
- 0
- Continue reading or reply
Trigger Doubt in finding the number of Contacts associated with Account
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;
}
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;
}
-
- PlatFormCloud
- May 22, 2016
- Like
- 0
- Continue reading or reply
Script Statement in Apex
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?
-
- PlatFormCloud
- May 15, 2016
- Like
- 0
- Continue reading or reply
Getter and Setter in Apex
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;}
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;}
-
- PlatFormCloud
- May 10, 2016
- Like
- 1
- Continue reading or reply
Converting GMT into Locale Users Time Zone
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?
-
- PlatFormCloud
- May 06, 2016
- Like
- 0
- Continue reading or reply
execution of BeforeUpdate caused by: System.NullPointerException: Attempt to de-reference a null object:
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;
}
}
}
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;
}
}
}
-
- PlatFormCloud
- May 01, 2016
- Like
- 0
- Continue reading or reply
Apex Governor limit
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?
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?
-
- PlatFormCloud
- April 26, 2016
- Like
- 0
- Continue reading or reply
Constructor and Debug Log
Can we able to see the debug ststement if we write System.Debug within a Constructor?
-
- PlatFormCloud
- April 26, 2016
- Like
- 0
- Continue reading or reply
Clone and DeepClone
Hi Experts,
What is the difference between Clone () and DeepClone() in Apex? When should we use what? Can someone explain with an example?
Thanks!
What is the difference between Clone () and DeepClone() in Apex? When should we use what? Can someone explain with an example?
Thanks!
-
- PlatFormCloud
- June 03, 2016
- Like
- 1
- Continue reading or reply
Getter and Setter in Apex
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;}
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;}
-
- PlatFormCloud
- May 10, 2016
- Like
- 1
- Continue reading or reply
System.Assert
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!
- PlatFormCloud
- August 09, 2016
- Like
- 0
- Continue reading or reply
Clone and DeepClone
Hi Experts,
What is the difference between Clone () and DeepClone() in Apex? When should we use what? Can someone explain with an example?
Thanks!
What is the difference between Clone () and DeepClone() in Apex? When should we use what? Can someone explain with an example?
Thanks!
- PlatFormCloud
- June 03, 2016
- Like
- 1
- Continue reading or reply
Apex Trigger: Need the Best solution, which can work for 100K records
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); } }
- PlatFormCloud
- May 28, 2016
- Like
- 0
- Continue reading or reply
Trigger Doubt in finding the number of Contacts associated with Account
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;
}
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;
}
- PlatFormCloud
- May 22, 2016
- Like
- 0
- Continue reading or reply
Getter and Setter in Apex
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;}
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;}
- PlatFormCloud
- May 10, 2016
- Like
- 1
- Continue reading or reply
Converting GMT into Locale Users Time Zone
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?
- PlatFormCloud
- May 06, 2016
- Like
- 0
- Continue reading or reply
What is apex:repeat component is salesforce?
Hi,
Please any one can explain me about apex:repeat component in salesforce? where we can use?
regards,
Sain
Please any one can explain me about apex:repeat component in salesforce? where we can use?
regards,
Sain
- Sain
- August 11, 2015
- Like
- 0
- Continue reading or reply