Activity › Forums › Salesforce® Discussions › How to ensure FLS while working with Lightning Component?
-
How to ensure FLS while working with Lightning Component?
Posted by Prachi on September 13, 2018 at 1:42 PMHow to ensure FLS while working with Lightning Component?
Parul replied 7 years, 8 months ago 5 Members · 4 Replies -
4 Replies
-
Hi Prachi,
FLS and CRUD are not automatically enforced in the lightning component whenever any object is referenced in the Apex Controller and the component will display the fields and records for which the users do not have access. Therefore we should manually enforce the FLS and CRUD in the Apex Controller, or we should try to use Lightning Data service wherever possible because it takes care of FLS and CRUD for us.
Thanks.
- [adinserter block='9']
-
Hello Prachi,
FLS is ensured by manually or by lightning Data Service.
Thanks.
-
Hi,
FLS stands for field level security. FLS can be ensure by adding permission checks before performing DML.
Suppose we are performing DML on account object and we want to ensure FLS for name field then :For an upsert DML
Account acc = new Account();if(Schema.sObjectType.account.fields.name.isCreateable() && Schema.sObjectType.account.fields.name.isUpdateable()){
acc.name = ‘Test’;
}here it checks weather user has permission to update and create name field or not. this is how it is ensuring the FLS. similarly we can add checks for some other DML’s.
Hope this helps!
-
This reply was modified 7 years, 8 months ago by
shariq.
-
This reply was modified 7 years, 8 months ago by
-
Hi.
Lightning Data Services already ensures Field Level Security and we can also use the Apex using isAccessible, isCreateable, isDeleteable, isCreateable and etc methods of Schema class.
Thanks
Log In to reply.