+ Start a Discussion
Nagaraju GorliNagaraju Gorli 

FLS Create security issues

//Whaen i insert the Attachment Code ,i write below code .But im getting FLS security issuess plz help me

            attachment.Ownerid = tsk.ownerid;
        if(Schema.sObjectType.Attachment.fields.ParentId .isCreateable())
            attachment.ParentId = tsk.Id; // the record the file is attached to
            attachment.name = fileName;
            if (Schema.sObjectType.Attachment.fields.body.isCreateable()){
                insert attachment;   
SandhyaSandhya (Salesforce Developers) 
Hi Nagaraju Gorli,

Please consider below points.

Sharing rules are distinct from object-level and field-level permissions. They can coexist. If sharing rules are defined in Salesforce, you can enforce them at the class level by declaring the class with the with sharing keyword. For more information, see Using the with sharing or without sharing Keywords. If you call the sObject describe result and field describe result access control methods, the verification of object and field-level permissions is performed in addition to the sharing rules that are in effect. Sometimes, the access level granted by a sharing rule could conflict with an object-level or field-level permission.

From below link.


For a similar discussion, please refer below the post.

Hope this helps you!

If this helps you please mark it as solved.

Thanks and Regards