-
ChatterFeed
-
0Best Answers
-
1Likes Received
-
0Likes Given
-
22Questions
-
31Replies
Hi Friends, If(schema.sobjecttype.Contact_Cash_Tracking__c.isaccessible()) { If (string.valueof(account.Validation_Methods__c).contains ('Cash Tracking')) }
For the line 2 the following error is thrown:
System.NullPointerException: Attempt to de-reference a null object
How to avoid this exception?
Please help.
System.NullPointerException: Attempt to de-reference a null object
How to avoid this exception?
Please help.
- swapna muthiyalu
- March 02, 2020
- Like
- 0
- Continue reading or reply
hi all, My requirement is to add the filterCas as attachment in email and send? i have the following code
Map<id,case> csmap = new Map<id,case>([select id,(select id,Type__c,Activities__r ) ,
CaseNumber from case ];
list<Case> filterCas= new list<Case>();
list<Activity__c> li = new list<Activity__c>();
for(case tempcase:csmap.values()){
for(Activity__c ac:tempcase.Activities__r){
if (ac.Type__c == 'Info'){
filterCas.add(tempcase);
}
system.debug('fitered Case'+ filterCas);
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String address = 'xxx@gmail.com';
String subject = 'List of Records';
String[] toAddresses = new String[] {address};
mail.setToAddresses(toAddresses);
mail.setSubject(subject);
mail.setPlainTextBody(body);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
}
}
CaseNumber from case ];
list<Case> filterCas= new list<Case>();
list<Activity__c> li = new list<Activity__c>();
for(case tempcase:csmap.values()){
for(Activity__c ac:tempcase.Activities__r){
if (ac.Type__c == 'Info'){
filterCas.add(tempcase);
}
system.debug('fitered Case'+ filterCas);
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String address = 'xxx@gmail.com';
String subject = 'List of Records';
String[] toAddresses = new String[] {address};
mail.setToAddresses(toAddresses);
mail.setSubject(subject);
mail.setPlainTextBody(body);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
}
}
- swapna muthiyalu
- May 14, 2019
- Like
- 0
- Continue reading or reply
- swapna muthiyalu
- March 18, 2019
- Like
- 0
- Continue reading or reply
select field,oldvalue,newvalue,contactid, contact.name,account.name FROM contacthistory . i tried this query to fetch account name without using nested query, but throwing error.please help
i want to fetch account name from this query.
- swapna muthiyalu
- July 26, 2018
- Like
- 0
- Continue reading or reply
i have the code
set<string>mEmpId = new set<string>();
map<string,id> MEmpIds = new map<string,id>();
list<Contact> con = [SELECT id,eid,AccountId, from Contact where (eid__c IN :mEmpId);
for(Contact c : con)
{
if(mEmpId.contains(m.eid__c)
{
MEmpIds.put(m.eid__c, c.Id);
}
}
how to use map of map for map<id,map<string,id>> MEmpIds = new map<string,id>(); and validate the put is from respective account id
map<string,id> MEmpIds = new map<string,id>();
list<Contact> con = [SELECT id,eid,AccountId, from Contact where (eid__c IN :mEmpId);
for(Contact c : con)
{
if(mEmpId.contains(m.eid__c)
{
MEmpIds.put(m.eid__c, c.Id);
}
}
how to use map of map for map<id,map<string,id>> MEmpIds = new map<string,id>(); and validate the put is from respective account id
- swapna muthiyalu
- April 25, 2018
- Like
- 0
- Continue reading or reply
contact object query
i have this query, select id, accountid, seccon__r.accountid from contact..
now how to write the same query to check if accountid is equal to seccon__r.accountid ?
now how to write the same query to check if accountid is equal to seccon__r.accountid ?
- swapna muthiyalu
- April 20, 2018
- Like
- 0
- Continue reading or reply
validate contact and account id
set<string>mEmpId = new set<string>();
set<string>hEmpId = new set<string>();
if (mEmpId .size() == 0 && hEmpId.size() > 0){
list<Contact> mgrHrRecs = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];
} else if(hEmpId.size() == 0 && mEmpId.size() > 0){
list<Contact> mgrHrRecs = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];
}else if (mEmpId.size() > 0 && hEmpId.size() > 0)
{list<contact>listcon = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexm__c = ‘yes’) or (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];} ;
The requirement is i have account say Burlington textiles, i have many contacts and they have empid__c. similar way there are many accounts and related contacts with empid__c. but the empid__c may be same for many contacts. now i want to validate that the reportsto field in contact has the same contact which belongs to the same account,which is not validated in the above code. for example i have jack as contact who belongs to the account burligton, has Peter in the report to field, now i have to validate that peter also belongs to the burlington account.
set<string>hEmpId = new set<string>();
if (mEmpId .size() == 0 && hEmpId.size() > 0){
list<Contact> mgrHrRecs = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];
} else if(hEmpId.size() == 0 && mEmpId.size() > 0){
list<Contact> mgrHrRecs = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];
}else if (mEmpId.size() > 0 && hEmpId.size() > 0)
{list<contact>listcon = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexm__c = ‘yes’) or (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];} ;
The requirement is i have account say Burlington textiles, i have many contacts and they have empid__c. similar way there are many accounts and related contacts with empid__c. but the empid__c may be same for many contacts. now i want to validate that the reportsto field in contact has the same contact which belongs to the same account,which is not validated in the above code. for example i have jack as contact who belongs to the account burligton, has Peter in the report to field, now i have to validate that peter also belongs to the burlington account.
- swapna muthiyalu
- April 17, 2018
- Like
- 0
- Continue reading or reply
how to convert the following query into dynamic query?
set<string>mEmpId = new set<string>();
set<string>hEmpId = new set<string>();
if (mEmpId .size() == 0){
list<Contact> mgrHrRecs = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];
} else if(hEmpId.size() == 0){
list<Contact> mgrHrRecs = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];
}else if (mEmpId.size() > 0 && hEmpId.size() > 0)
{list<contact>listcon = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexm__c = ‘yes’) or (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];} ;
set<string>hEmpId = new set<string>();
if (mEmpId .size() == 0){
list<Contact> mgrHrRecs = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];
} else if(hEmpId.size() == 0){
list<Contact> mgrHrRecs = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];
}else if (mEmpId.size() > 0 && hEmpId.size() > 0)
{list<contact>listcon = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexm__c = ‘yes’) or (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];} ;
- swapna muthiyalu
- April 12, 2018
- Like
- 0
- Continue reading or reply
i have the following code
set<string>mEmpId = new set<string>();
set<string>hEmpId = new set<string>();
list<contact>listcon = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexm__c = ‘yes’) or (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ]
now i want to check if mEmpId and hEmpId are blank and if it is blank i have to run this query? how to check the set is empty?
set<string>hEmpId = new set<string>();
list<contact>listcon = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexm__c = ‘yes’) or (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ]
now i want to check if mEmpId and hEmpId are blank and if it is blank i have to run this query? how to check the set is empty?
- swapna muthiyalu
- April 11, 2018
- Like
- 0
- Continue reading or reply
- swapna muthiyalu
- January 04, 2018
- Like
- 0
- Continue reading or reply
- swapna muthiyalu
- December 17, 2017
- Like
- 0
- Continue reading or reply
- swapna muthiyalu
- December 04, 2017
- Like
- 0
- Continue reading or reply
- swapna muthiyalu
- April 19, 2017
- Like
- 1
- Continue reading or reply
- swapna muthiyalu
- April 19, 2017
- Like
- 1
- Continue reading or reply
hi all, My requirement is to add the filterCas as attachment in email and send? i have the following code
Map<id,case> csmap = new Map<id,case>([select id,(select id,Type__c,Activities__r ) ,
CaseNumber from case ];
list<Case> filterCas= new list<Case>();
list<Activity__c> li = new list<Activity__c>();
for(case tempcase:csmap.values()){
for(Activity__c ac:tempcase.Activities__r){
if (ac.Type__c == 'Info'){
filterCas.add(tempcase);
}
system.debug('fitered Case'+ filterCas);
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String address = 'xxx@gmail.com';
String subject = 'List of Records';
String[] toAddresses = new String[] {address};
mail.setToAddresses(toAddresses);
mail.setSubject(subject);
mail.setPlainTextBody(body);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
}
}
CaseNumber from case ];
list<Case> filterCas= new list<Case>();
list<Activity__c> li = new list<Activity__c>();
for(case tempcase:csmap.values()){
for(Activity__c ac:tempcase.Activities__r){
if (ac.Type__c == 'Info'){
filterCas.add(tempcase);
}
system.debug('fitered Case'+ filterCas);
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String address = 'xxx@gmail.com';
String subject = 'List of Records';
String[] toAddresses = new String[] {address};
mail.setToAddresses(toAddresses);
mail.setSubject(subject);
mail.setPlainTextBody(body);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
}
}
- swapna muthiyalu
- May 14, 2019
- Like
- 0
- Continue reading or reply
- swapna muthiyalu
- March 18, 2019
- Like
- 0
- Continue reading or reply
select field,oldvalue,newvalue,contactid, contact.name,account.name FROM contacthistory . i tried this query to fetch account name without using nested query, but throwing error.please help
i want to fetch account name from this query.
- swapna muthiyalu
- July 26, 2018
- Like
- 0
- Continue reading or reply
i have the code
set<string>mEmpId = new set<string>();
map<string,id> MEmpIds = new map<string,id>();
list<Contact> con = [SELECT id,eid,AccountId, from Contact where (eid__c IN :mEmpId);
for(Contact c : con)
{
if(mEmpId.contains(m.eid__c)
{
MEmpIds.put(m.eid__c, c.Id);
}
}
how to use map of map for map<id,map<string,id>> MEmpIds = new map<string,id>(); and validate the put is from respective account id
map<string,id> MEmpIds = new map<string,id>();
list<Contact> con = [SELECT id,eid,AccountId, from Contact where (eid__c IN :mEmpId);
for(Contact c : con)
{
if(mEmpId.contains(m.eid__c)
{
MEmpIds.put(m.eid__c, c.Id);
}
}
how to use map of map for map<id,map<string,id>> MEmpIds = new map<string,id>(); and validate the put is from respective account id
- swapna muthiyalu
- April 25, 2018
- Like
- 0
- Continue reading or reply
contact object query
i have this query, select id, accountid, seccon__r.accountid from contact..
now how to write the same query to check if accountid is equal to seccon__r.accountid ?
now how to write the same query to check if accountid is equal to seccon__r.accountid ?
- swapna muthiyalu
- April 20, 2018
- Like
- 0
- Continue reading or reply
validate contact and account id
set<string>mEmpId = new set<string>();
set<string>hEmpId = new set<string>();
if (mEmpId .size() == 0 && hEmpId.size() > 0){
list<Contact> mgrHrRecs = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];
} else if(hEmpId.size() == 0 && mEmpId.size() > 0){
list<Contact> mgrHrRecs = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];
}else if (mEmpId.size() > 0 && hEmpId.size() > 0)
{list<contact>listcon = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexm__c = ‘yes’) or (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];} ;
The requirement is i have account say Burlington textiles, i have many contacts and they have empid__c. similar way there are many accounts and related contacts with empid__c. but the empid__c may be same for many contacts. now i want to validate that the reportsto field in contact has the same contact which belongs to the same account,which is not validated in the above code. for example i have jack as contact who belongs to the account burligton, has Peter in the report to field, now i have to validate that peter also belongs to the burlington account.
set<string>hEmpId = new set<string>();
if (mEmpId .size() == 0 && hEmpId.size() > 0){
list<Contact> mgrHrRecs = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];
} else if(hEmpId.size() == 0 && mEmpId.size() > 0){
list<Contact> mgrHrRecs = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];
}else if (mEmpId.size() > 0 && hEmpId.size() > 0)
{list<contact>listcon = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexm__c = ‘yes’) or (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];} ;
The requirement is i have account say Burlington textiles, i have many contacts and they have empid__c. similar way there are many accounts and related contacts with empid__c. but the empid__c may be same for many contacts. now i want to validate that the reportsto field in contact has the same contact which belongs to the same account,which is not validated in the above code. for example i have jack as contact who belongs to the account burligton, has Peter in the report to field, now i have to validate that peter also belongs to the burlington account.
- swapna muthiyalu
- April 17, 2018
- Like
- 0
- Continue reading or reply
how to convert the following query into dynamic query?
set<string>mEmpId = new set<string>();
set<string>hEmpId = new set<string>();
if (mEmpId .size() == 0){
list<Contact> mgrHrRecs = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];
} else if(hEmpId.size() == 0){
list<Contact> mgrHrRecs = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];
}else if (mEmpId.size() > 0 && hEmpId.size() > 0)
{list<contact>listcon = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexm__c = ‘yes’) or (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];} ;
set<string>hEmpId = new set<string>();
if (mEmpId .size() == 0){
list<Contact> mgrHrRecs = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];
} else if(hEmpId.size() == 0){
list<Contact> mgrHrRecs = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];
}else if (mEmpId.size() > 0 && hEmpId.size() > 0)
{list<contact>listcon = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexm__c = ‘yes’) or (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];} ;
- swapna muthiyalu
- April 12, 2018
- Like
- 0
- Continue reading or reply
i have the following code
set<string>mEmpId = new set<string>();
set<string>hEmpId = new set<string>();
list<contact>listcon = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexm__c = ‘yes’) or (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ]
now i want to check if mEmpId and hEmpId are blank and if it is blank i have to run this query? how to check the set is empty?
set<string>hEmpId = new set<string>();
list<contact>listcon = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexm__c = ‘yes’) or (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ]
now i want to check if mEmpId and hEmpId are blank and if it is blank i have to run this query? how to check the set is empty?
- swapna muthiyalu
- April 11, 2018
- Like
- 0
- Continue reading or reply