Linked Questions

5 votes
1 answer

How to improve schema access performance [duplicate]

We have Apex code that needs to interrogate the schema to dynamically handle configuration-based behaviour (e.g. for defining fields that should be loaded or saved) for specific types of object (such ...
Phil W's user avatar
  • 34.1k
2 votes
1 answer

Is it possible to get valuetypes of fields of a JSON object without using getGlobalDescribe() [duplicate]

I have the following piece of code to get the valuetype. Is it possible to do this with getSObjectType() instead of getGlobalDescribe() since this is a lot slower. Apex Map<String, Object> ...
Thomas's user avatar
  • 2,294
16 votes
2 answers

How to convert a string to sObjectType

I have a object A where I am saving the name of the object as Strings and the fields also as String. Eg: If I have object Account, contact and opp objects. I am saving object Account as object Name ...
Anu's user avatar
  • 3,817
11 votes
5 answers

Get the type (data type) of a field in apex

I need to get the type (or data type) of a field (like if it is a date or integer for example) in apex. I only have the name (api) of the object and the name of the field. How can I do that ?
dou's user avatar
  • 1,909
9 votes
3 answers

converting string to Schema.SObjectField

I have created an API But struggling in converting String to Schema.SObjectField as If there is any possible way to cast string into Schema.SObjectField field type for example Account.example__c to ...
cloudy-ritz's user avatar
  • 2,583
1 vote
2 answers

Access object fields through String

Is it possible to access all of an objects fields through the schema class using a string? I know we can do this with an id. Schema.DescribeSObjectResult sor = id.getSobjectType().getDescribe(); Is ...
Matthew Metros's user avatar
2 votes
2 answers

Dynamically get object info

I see so many examples like below; however, I want to be able to pass a string that holds 'Account' or custom object name for example. The examples I see on SF are hard coding Account. The reason I ...
TomB's user avatar
  • 33
0 votes
2 answers

How to get List of Custom fields using dynamic apex [closed]

I am trying to get list of custom fields of an object using dynamic apex
Gaurav Wadghule's user avatar
1 vote
2 answers

Check field is updatable

I have object and field name, but don't understand how to check if that field isUpdatable. It gives me the error: Variable does not exist: fields SObjectType objectType = Schema.getGlobalDescribe()....
Samuelid's user avatar
3 votes
1 answer

Trying to solve an unclear "Apex CPU time limit exceeded" error on lightning component

I currently use a genuinely wonderful add-on component FieldsetLightningCompForm to display input/output fields on records that reference Field Sets to determine what is shown. It's beyond useful for ...
Evan Kelly's user avatar
2 votes
1 answer

Attempt to de-reference a null object when using alternative to getGlobalDescribe

In the following code String myString = 'Account'; SObjectType sObjType = ((SObject) Type.forName(myString).newInstance()).getSObjectType(); When myString = a object name does not exist i get a ...
Vneq's user avatar
  • 79
1 vote
0 answers

Provide Read access to all Objects and their fields in my entire ORG

I have written the below script in order to provide Read permission on all my Objects and their fields. I have managed Objects, standard and custom objects on the Org. I am maintaining all Objects in ...
vara's user avatar
  • 75
2 votes
2 answers

Schema.describeSObjects() returns incorrect values

When I use Schema.describeSObjects() the result always returns isDeletable=TRUE, even though the current user doesn't have DELETE permission on an sObject; however if Schema.sObjectType.<<...
Tanmay K's user avatar
3 votes
1 answer

How to verify in APEX if the organization has notes enabled?

To be more specific, I am talking about the 'new' notes introduced with the Summer '15 release link Would it be enough to verify if ContentNote is available by using: Boolean isNotesEnabled = ...
Perennialista's user avatar