function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
binbin0915binbin0915 

how to get accessibility of Object Task's ID

my code is like that
if (!Schema.sObjectType.Task.fields.Id.isCreateable()){
          return null;
}

but security check   http://security.force.com/security/tools/forcecom/scanner#

show serious errs:
FLS_CREATE

Ashish_SFDCAshish_SFDC
Hi , 


Did not quite understand what exactly you are looking for?

The error is saying something about Field Level Security - Create permission. 

Why is the loop returning null and what is that you checking with the field accessibility. 


Regards,
Ashish
Carolina Ruiz MedinaCarolina Ruiz Medina
Hi Binbin,
In order to pass security review it is true you need to check the CRUD, hope this code helps, this is what we have and we dont have issues.


beforeInsert
    if(!myCustomObject__c.sObjectType.getDescribe().isCreateable())
     {
          throw new AppException(Label.accessDeniedonInsert);
     }
beforeUpdate
     if(!myCustomObject__c.sObjectType.getDescribe().isUpdateable())
     {
      throw new AppException(Label.accessDeniedonInsert);
     }
beforeDelete
      if(!myCustomObject__c.sObjectType.getDescribe().isDeletable())
     {
      throw new AppException(Label.accessDeniedonDelete);
     }


Kind Regards,
Carolina.