You need to sign in to do that
Don't have an account?
shravani mil
Error:List has no rows for assignment to SObject
Hi
Can any one help me out of this error
System.QueryException: List has no rows for assignment to SObject .
error line recordtype = [SELECT Id FROM RecordType WHERE SobjectType = 'EXM__c' AND DeveloperName = : developerName LIMIT 1].Id;
Thanks.
Can any one help me out of this error
System.QueryException: List has no rows for assignment to SObject .
error line recordtype = [SELECT Id FROM RecordType WHERE SobjectType = 'EXM__c' AND DeveloperName = : developerName LIMIT 1].Id;
Thanks.
Kindly mark it as a solution if that works.
All Answers
Kindly mark it as a solution if that works.
List<RecordType> lstErrorRecordType = [SELECT Id FROM RecordType WHERE SobjectType = 'EXM__c' AND DeveloperName = : developerName LIMIT 1];
if(!lstErrorRecordType.isEmpty()){
// your code when you have such a record type
}
else{
// some message or email or or a default recordtype to be set or any action stating such record type //doesn't exist
}
Thanks for all yours quick reply.
this test is passing in uat and its getting failed in prod?
Thanks
Add the following utility method in your test class
Then get the recordtype for the object by passing the objectName and the recordtypename