• swapna muthiyalu
  • NEWBIE
  • 90 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 22
    Replies
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 ?
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>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>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?
 
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 ?
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>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>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?
 
I'm doing the simple lightning components challenge and have hit this problem in my existing trailhead org and a brand new dev org that I've just created:

Challenge not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: QVWBQHAG