• #33922
     Prachi #9
    Forcetalks

    How to ensure FLS while working with Lightning Component?

    How to ensure FLS while working with Lightning Component?

    #33924
    Forcetalks

    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.

    #33932
    Forcetalks

    Hello Prachi,

    FLS is ensured by manually or by lightning Data Service.

    Thanks.

    #33941
    Salesforce | shariq shariq #1
    Forcetalks

    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 2 months, 1 week ago by Salesforce | shariq shariq.
    #33950
    Salesforce | Parul Parul #2
    Forcetalks

    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

Viewing 5 posts - 1 through 5 (of 5 total)

Please to reply to this topic.

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2018 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?