You need to sign in to do that
Don't have an account?

FLS checking for the code
Hi All,
I want to check FLS permissions at field level since it comes as an issue in checkmarx report. The below code is
Kindly help me how to check FLS pers=missions at field level and kindly tell me how to test the code after changes.
Thanks,
I want to check FLS permissions at field level since it comes as an issue in checkmarx report. The below code is
global class AsyncApexClass{ @future public static void sendEmail(Set<Id> sendList){ List <Notes__c> notesList = new List<Notes__c>(); notesList.clear(); for(List<EmailMessage> emailmsglist:[select Id,parentId,Parent.Email__c,Parent.Contact.Email,ToAddress, FromAddress, Subject, TextBody, HTMLBody, CreatedDate from EmailMessage where id in :sendList] ) { for(EmailMessage emlist :emailmsglist){ Notes__c note= new Notes__c(); // Create a note object note.Case__c= emlist.parentid; IF (emlist.HTMLBody != NULL && emlist.HTMLBody != ''){ note.Message__c = emlist.HTMLBody; } else { note.Message__c = emlist.TextBody; } note.Sent_To__c = emlist.ToAddress; note.From__c = emlist.FromAddress; note.Subject__c = emlist.Subject; note.Datetime_Created__c = emlist.CreatedDate; if (emlist.Parent.Contact.Email == emlist.ToAddress || emlist.Parent.Email__c == emlist.ToAddress) // If the email is the same as Case's contact email or Email__c on Case itself, the type is a response. { note.Type__c = 'Response'; } else { note.Type__c = 'Forward/Others'; } notesList.add(note); // Add note object to the list } } // If the note list has records, insert the list. if(notesList.size()>0) { insert notesList; } } }
Kindly help me how to check FLS pers=missions at field level and kindly tell me how to test the code after changes.
Thanks,
Check this link:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_perms_enforcing.htm
This will tell you everything you need to implement FLS in your code
You can find here how to implement CRUD FLS for various objects in salesforce .
https://github.com/TintuBabu/CRUD_FLS/