I have a list of custom metadata type. I need to check if the string element is present in custom metadata type. Currently, I'm hardcoding the browser name in my if condition, but I need to compare this with the records present in custom metadata type. Can someone give a hand with this? I'm new to Apex. Thanks!
public boolean evaluate(TxnSecurity.Event e)
{
if (e.action == 'Login' )
{
List<Browsers__mdt> Brow = [Select Browser__c from Browsers__mdt];
LoginHistory loginAttempt =
[SELECT Browser FROM LoginHistory
WHERE Id = :e.data.get('LoginHistoryId') AND LoginType='Application'];
String browser = loginAttempt.Browser;
if (browser.startsWith('Chrome'))
{
return false;
}
}
return true;
}