You need to sign in to do that
Don't have an account?
Sudhanwa
15/18 char salesforce record Id's funda
Hi,
I have this piece of code in my controller that I need to cover in test method -
profileCount = [SELECT count() FROM Profile p WHERE p.name like '%Specific User%' and p.id =: LoginUserProfileId] ;
if(profileCount > 0)
{
isSpecificUser = true;
}
else
{
isSpecificUser = false;
}
The condtition never matches as the Salesforce schema fetches 18 chars ID and the browser fetches 15 chars. How can this be achieved?
Thanks,
Sudhanwa.
I don't think the 15/18 character id is the problem. It's more likely that the profile name doesn't match '%Specific User%' or for some reason the test method when run doesn't have access to the profile table. (Do you have a runAs statement in your test class?)
force.com will match correct 15 or 18 digit ids to the full 18 digit id - try it in eclipse - or for another record type e.g. contact, opportunity etc... in your test method.
Good luck.