You need to sign in to do that
Don't have an account?
venkat gattamaneni
How to add field level security in apex while updating?
isUpdateable() -
Returns true if the field can be edited by the current user, false
otherwise.
Is this a correct syntax ?
if(!CategoryMobileConfig__c.Active__c.getDescribe().isUpdateable()) // FLS
{
update mobileAppConfig;
}
Hi,
The syntax is :
if (!Schema.sObjectType.CategoryMobileConfig__c.fields.Active__c.isUpdateable()){
//Do your work.
}
go to the following url for reference :
http://wiki.developerforce.com/page/Testing_CRUD_and_FLS_Enforcement
Hi
Try this
Schema.DescribeFieldResult f = CategoryMobileConfig__c.Active__c.getDescribe();
Boolean notReadonly = f.isUpdateable()
if( !notReadonly ){
update mobileAppConfig;
}
You can refer this link .
http://boards.developerforce.com/t5/Apex-Code-Development/How-do-you-determine-field-level-security-field-visibility/td-p/175557
Did this solve your problem.. If so please mark it solved.. so that others get benifited.
Thanks
asish
With the new feature released in Winter '19, now we can strip the fields which are not accessible by the user. More details are available on the below link: https://releasenotes.docs.salesforce.com/en-us/summer19/release-notes/rn_apex_Security_stripInaccessible.htm
I have also explored this feature in this post: https://initaura.com/field-level-security-in-apex/
Hope this helps.
Thanks and Regards,
Neha Aggrawal
www.initaura.com - Everything Salesforce