Tag Archives: apex

Determine by Apex if Custom Field allows setting Field Level Security

There is FieldDefinition standard object, which is available in usual SOQL and in Tooling API. However, this object has different fields available in different ways of accessing it. It has a field IsFlsEnabled which is only available in Tooling API, … Continue reading

Posted in apex, field, salesforce | Tagged , , , , , , , , | Leave a comment

Efficient dynamic SObjectType retrieval in Salesforce

It is interesting how often we use inefficient code. For example, if we want dynamically get SObjectType for given custom object by its String representation, how do we usually implement it? Have you seen code like following? public static SObjectType … Continue reading

Posted in apex, salesforce | Tagged , , , | Leave a comment

Apex Data Generation library

Today I am opensourcing and introducing my Apex Data Generation library, which can be called as a framework or as builder as well. More than year back, I was considering of introducing my Salesforce unit test framework, however, I didn’t open source … Continue reading

Posted in salesforce, Uncategorized | Tagged , , , | Leave a comment

Salesforce: Impossible to invoke Lightning or Visualforce actions in Apex Code

When I saw QuickAction class and QuickAction.QuickActionRequest object I assumed that it supports Lightning and Visualforce actions, however, in fact, it doesn’t. I created two actions. Lightning Action on Account and called it LA and Visualforce action on Account and called it VA. When … Continue reading

Posted in Actions, lightning, salesforce, Uncategorized, visualforce | Tagged , , , , , , | Leave a comment

Salesforce: use Apex Code to grant permissions to custom object and fields

List<Id> profilePermissionsSetIds = [ select id, Profile.UserLicense.Name from PermissionSet where IsOwnedByProfile = true and Profile.UserLicense.Name = ‘Salesforce’]; List<ObjectPermissions> objPermissions = new List<ObjectPermissions>(); for ( String pId: profilePermissionsSetIds ) { objPermissions.add( new ObjectPermissions ( SObjectType = ‘Custom_Object__c’, ParentId = pId, PermissionsRead … Continue reading

Posted in Administration, apex, Profile, salesforce, Uncategorized | Tagged , , , , , , , , , | Leave a comment