I have a string which is holding email ids of users from my org.
Now I have few custom metadata type records which are holding email IDs of users who are inactive.
Now I need to compare the string which has all my users' email IDs with that of custom metadata type Email field.
It is like
If(allEmailIds == Inactive_Email__c){ //allEmailIds is the string holding my org users' email ids
//do the logic here;
}
I knew the query to fetch custom metadatatype records into apex but I'm not getting the logic to compare these two values.
Below is the query of my custom metadata type object
Select MasterLabel, Inactive_Email__c from InactiveUsers__mdt
Can anyone please help me out with this requirement.
Best Answer
As comments suggests there might be some better solutions to get or store InActive Users information rather than using Custom Metadata Type records for it.
But to your question - Sounds like you are trying to get a field value (
Inactive_Email__c
) from a Custom Metadata Type records stored onInactiveUsers__mdt
and then compare it with a different string value received as Input or from a different Query.Below Example can show a way to achieve this...