Questions tagged [describefieldresult]

is a class that contains methods for describing sObject fields.

Filter by
Sorted by
Tagged with
0 votes
1 answer
724 views

Check if any field of a record has change dyncamically for a bulk trigger

I am trying to run validation in before update trigger which checks if a field value has changed in a particular status for the record. If it has changed then it adds a validation error. I wanted to ...
Madhurima's user avatar
  • 1,265
6 votes
1 answer
696 views

How to find the encrypted fields from inside an LWC?

I have Shield Platform Encryption turned on for Account.Name and a server-side field describe call: System.debug(JSON.serializePretty(Account.Name.getDescribe())); returns as expected these ...
Keith C's user avatar
  • 135k
4 votes
1 answer
160 views

DescribeFieldResult .IsCascadeDelete()/isRestrictedDelete() don't return the correct value for Opportunity.AccountId/Case.AccountId fields

In Case Object there is a "special" lookup field to Account, with the API Name AccountId and Label Account Id (btw in the UI we see Account Name as the field's label which is the name we ...
SFAxl's user avatar
  • 41
0 votes
1 answer
685 views

Determine `SObject type` from relationship name without an exhaustive search

Consider a general relation 'Foo.Bar' and some SObject type. An example might be 'Account.Id' and an Opportunity.SObjectType. Can I determine SObjectType Foo is referring to without getting the field ...
ipavlic's user avatar
  • 3,684
2 votes
0 answers
1k views

Using Apex to query Country Picklist Integration Values

We are using global country picklist in our org. For historical reasons, some of our countries have a difference in the name of the country and the integration value of the country. From Apex, I ...
hamayoun's user avatar
  • 2,727
0 votes
2 answers
938 views

Is an Address and Location SObjects or a Compound Fields?

I am trying to build a picklist which would display all the available SObject, and global describe returns me some strange SObject Address, when I try to instantiate dynamically this SObject, it fails ...
Patlatus's user avatar
  • 16.1k
1 vote
1 answer
110 views

Use multiple languages on Schema.DescribeFieldResult

Is it possible to pass language on Schema.DescribeFieldResult so that I can get the field labels translated in multiple languages in apex?
Raksha's user avatar
  • 47
0 votes
1 answer
355 views

How to get pedefined field value mentioned in QuickAction?

Quick Action : SendMail I want to get predefined values using Apex QuickAction.QuickActionRequest req = new QuickAction.QuickActionRequest(); req.quickActionName = Schema.Case.QuickAction.SendEmail;...
Farkous's user avatar
  • 27
1 vote
1 answer
812 views

Get dependent picklist name from controller picklist name using APEX

I got a situation that if I pass the controlling picklist name then I have to find the dependent picklist field name using APEX. I know the vice versa can be achieved though ie , Dependent ----> ...
SFDC-Beginner's user avatar
1 vote
1 answer
49 views

Why Does Describe Information Always Return True for Updateable on Read-Only Fields?

I cloned the Administrator profile, removed the Edit permission for some fields on Opportunity Product, and applied the cloned profile to a non-admin user. I logged in as this user and went to a ...
YXY's user avatar
  • 130
1 vote
0 answers
119 views

No such field ActivityOriginType even though returned through field map

We have an all fields query that gets the field map from an object's describe in Apex. It then loops over the map and assembles a query. In one clients org, the field map is spitting out ...
Tyler Dahle's user avatar
  • 2,629
3 votes
0 answers
1k views

Get the active and inactive values from the Picklist

I'm trying to get the active and inactive values, especially the inactive ones, from a picklist to activate them via code. The problem is that I can only get the active values. List<String> ...
dsd's user avatar
  • 121
2 votes
0 answers
1k views

DescribeFieldResult.getReferenceTo returns only one type in a specific scenario

I am seeing some strange behavior where DescribeFieldResult.getReferenceTo returns only one type for the Lead.OwnerId field in some cases when invoked in a trigger context. The code below displays ...
Jelle van Geuns's user avatar
4 votes
1 answer
1k views

In order to check if a field is required or not, is the result of isNillable method sufficient?

Accordingly to the documentation of isNillable method of Schema.DescribeFieldResult class: isNillable() Returns true if the field is nillable, false otherwise. A nillable field can have ...
gvgramazio's user avatar
3 votes
1 answer
330 views

Identifying the controlling picklist of a dependent picklist

Is it possible to identify the controlling picklist for a dependent picklist in Apex. Currently, I am using the DescribeFieldResult class to get information on object fields; type, name, length, etc. ...
Matt LeDonne's user avatar
2 votes
0 answers
156 views

Field History object - value of column "Field" when tracked field is lookup (standard v custom)

I'm trying to selectively delete an SObject's field histories based on the members of an sobject's fieldset (think PII deletion - feature available V42). Example: OOTB Order with field set containing:...
cropredy's user avatar
  • 69.9k
3 votes
1 answer
613 views

When is the AccountId field not available as a merge field for JS buttons

May be a basic question but I could not find specific documentation and I need to find out all objects where: The accountid field is NOT available as a merge field is a javascript button. In these ...
Eric's user avatar
  • 54k
4 votes
2 answers
517 views

SObjectType.newSobject(null, true) doesn't populate default values if called in vf action method, any tips?

I'm trying to create an sObject instance using following code: Schema.SObjectType targetType = Schema.getGlobalDescribe().get(objectName); sObject sObj = targetType.newSObject(null, true); This ...
VarunC's user avatar
  • 5,920
8 votes
1 answer
196 views

What are the 'magic' fields of Salesforce (e.g. Case.Comments)?

I am writing a SOQL generator that grabs the list of readable fields for an object and creates a query to fetch the data. (Unrelated, but because "Why?" is often asked - this subroutine is part of a ...
LVB's user avatar
  • 93
0 votes
1 answer
36 views

How to get Two articles in One list using salesforce query

Hi every one I have a two articles: Offer__kav and Offer_order__kav. How to Query This Two Objects Related All Fields. For Ex: I tried : List<List<SObject>> search_results = [FIND 'SFDC'...
ali's user avatar
  • 13
4 votes
1 answer
390 views

How do I find out if a field is updateable by the System?

I am running a batch process that is marked without sharing. I would like to to take one course of action if the batch process can update a particular field, and another if not. For example: if (...
Charles Koppelman's user avatar
0 votes
0 answers
498 views

How to Comparable interface sort a List<String> of Schema.DescribeFieldResult.getName() entries by many DescribeFieldResult properties?

I use str to dynamically generate input fields on a visualforce page. Unlike standard page layouts that come with a drag and drop layout editor, my page's positioning of input fields depends on the ...
Peter Noges's user avatar
  • 1,100
3 votes
2 answers
853 views

Programatically how can I link Case Status Values to a Defined Business/Support Process

I am trying to create a custom visualforce page that is aware of the Case Status Values that are related to a specific Case Support Process. I am able to get all Status Picklist Values from a ...
dacology's user avatar
  • 2,952
2 votes
1 answer
132 views

Get All User References fields

I want to get dynamically all field for object (assume for Account) which are User reference . Using the describe method I can check that the field is Reference type but not clear how/if can I check ...
Liron C's user avatar
  • 1,764
6 votes
3 answers
8k views

Is there a way to read all Inactive values of Picklist?

Here is my code. I'm trying to read Picklist Values via code, but I also intend to find out all Inactive Values on the field as well, but those values are not getting called in below code: list<...
VarunC's user avatar
  • 5,920
1 vote
0 answers
406 views

How can the Describe for a Field of getPopulatedFieldsAsMap() be null

I'm doing a CRUD check on Field level, since under some weird circumstances our customers don't have update rights on Record level, but only on fields (it's a guest license). So in addition to the ...
itsmebasti's user avatar
  • 6,359
0 votes
2 answers
3k views

Dynamic SObject API Name from Object Label

Is there a way to fetch the Object API Name using the Dynamic Object label and Schema. The other way around i have done. But i need this way to get SF API Names to be sent through Rest. I tried for ...
AjaySFDC's user avatar
  • 618
1 vote
1 answer
335 views

getRelationshipOrder() returning null

I'm trying this simple statement and getting null, shouldn't this be returning 1 since its a master-detail relationship? I've tried at API V40,41,42. Is my syntax wrong? Here's the relevant ...
Phil B's user avatar
  • 5,026
8 votes
3 answers
483 views

Any way to check a field's updateablity ignoring profiles?

The DescribeFieldResult.isUpdateable method incorporates the "Edit Access" setting of the Field level Security for a field i.e. it considers the field settings in the current profile. Is there a way ...
Keith C's user avatar
  • 135k
1 vote
1 answer
1k views

"Field User.LastPasswordChangeDate is inaccessible in this context" when running 'Schema.sObjectField.getDescribe()'

The issue occurs when a bit more restricted profile is being used, so I am still reviewing whether it is actually the cause or if it's something else. n.b. we are working in a namespaced scratch org, ...
dzh's user avatar
  • 4,016
9 votes
0 answers
676 views

REST API error middlename,suffix,informalname fields do not exist but they appear in describe results

We develop a AppExchange package and are having an issue with middlename,suffix,informalname fields on the Contact object. The issue is these fields are returned through a describe call also filtering ...
Phil B's user avatar
  • 5,026
1 vote
2 answers
2k views

How do I find the field type of parent/grandparent fields etc?

I have in my SQL relationship fields. The have written this query under a custom object. ex: SELECT name,Contact__r.Account.CreatedBy.Name FROM Four_Level_Check__c LIMIT 5 My need is to find the ...
Aruna's user avatar
  • 407
4 votes
1 answer
1k views

How do we get Index fields of an Object in Apex?

I want all the index fields of a particular object in apex. I have searched through the Schema describe but couldn't find a way to identify the field as indexed.
Numaan Mohammad's user avatar
9 votes
1 answer
1k views

What is the difference between creatable vs. updatable on Schema.DescribeFieldResult

When writing CRUD and FLS checks in apex I have noticed that I can check for the following: Schema.DescribeFieldResult fieldDescribe = field.getDescribe(); fieldDescribe.accessible; fieldDescribe....
Jannis Bott's user avatar
1 vote
3 answers
2k views

Reading Lookup Filter criteria from SObject field descriptions?

We are implementing a special type of lookup window in a VisualForce page, which displays a set of potential records a user can select from to populate a Lookup value. As a means to allow users to ...
zeneto's user avatar
  • 107
5 votes
1 answer
576 views

How to differ between rollup-summary and formula fields using APEX Schema functions?

I'm using describe functions to retrieve a DescribeFieldResult. Now on an Object I have two fields: one is a formula and the other is a rollup-summary. How can I differentiate between these two "types"...
Uwe Heim's user avatar
  • 28.3k
0 votes
1 answer
363 views

Match two Sobject field API Names and put the common in a Set

I am trying to pass two Sobject names to a method and match using Schema the Field API Names common in both of them. Like I have Object1 having fields A__c, B__c,X__c. Object2 having fields A__c, ...
Testing_SFDC's user avatar
  • 2,940
0 votes
0 answers
463 views

Get SObjectField with same API Name dynamically across SObjects

I have a unique situation. I have several different SObjects that are using the same field API names and I'm trying to get them dynamically by passing the SObjectType. For instance. This is for a ...
Andrew L.'s user avatar
  • 837
0 votes
1 answer
2k views

Object and Field Describe in Lightning Component

Is it possible to get sObjectDescribe in Lightning Components? In my case I need to have all possible values of picklist-field, but filter out the list of options conditionally.
Yury Bondarau's user avatar
0 votes
2 answers
273 views

How to put in VF page a link to the full list of related records of a parent?

I've seen that when a related list in a record's detail page surpasses 5 (or something) records, there is a link in the bottom that navigates to the full list of related records and nothing else. In ...
Pedro Otero's user avatar
4 votes
1 answer
479 views

Is There an Easy Way to Retrieve Field's External Alias

When creating custom fields on external objects you have the ability to add "External Alias / External Column Name" of the corresponding field name in the external data source. I've got a situation ...
Boris Bachovski's user avatar
9 votes
1 answer
1k views

Is there is any way to get standard field api name from standard report types reports in apex?

I want to get the api name of the standard field being used in Reports of Standard report types. I used describe methods to get the columns used in a report. I analysed some of standard reports ...
Fakeha Quazi's user avatar
6 votes
1 answer
148 views

FieldPermissions.Field contains strings longer than described maximum

I'm investigating an issue where values of one of the columns on the "FieldPermissions" object get truncated when we sync them to a DB. The column in question is called "Field", and it contains the ...
Oleg Berfirer's user avatar
11 votes
2 answers
2k views

How to efficiently determine the `name` field of an sobject for dynamic query?

Is there a more efficient way to determine the name field of an sobject other than iterating through all the fields obtained via DescribeSOBjectResult? Often, the name field is simply Name but in ...
Doug Ayers's user avatar
  • 4,156
1 vote
1 answer
64 views

DescribeSObjectResult not fetching Picklist

Need urgent Help I am executing the following code in execute anonymous. String objtype = 'Lead'; SObject objToBeCreated ; if(objtype == 'User') objToBeCreated = new User(); ...
Sand Man's user avatar
2 votes
1 answer
734 views

How can I distinguish the different Textarea fields in apex?

In Salesforce there are 3 different Text Area fields: Text Area, Text Area (Long), and Text Area (Rich). I'm doing some processing in a custom class and I need to distinguish between the 3 ...
dBeltowski's user avatar
  • 3,038
2 votes
1 answer
2k views

Does the "Only" part of the "Due Date Only" label of Task.ActivityDate have some significance?

This describe call: Task.ActivityDate.getDescribe().getLabel() returns "Due Date Only" rather than "Due Date" (that is used in e.g. the Task edit page). Is there some significance to the "Only" ...
Keith C's user avatar
  • 135k
1 vote
1 answer
2k views

Schema sObjectType [Object] fields isUpdateable returns false despite profile config

Schema.sObjectType.Campaign.fields.My_CustObj_Id__c.isAccessible() // true Schema.sObjectType.Campaign.fields.My_CustObj_Id__c.isUpdateable() // false How is this possible?
Vladyslav K's user avatar
  • 2,713
0 votes
2 answers
497 views

Accessing static helper method in Visualforce page

I'm trying to access helper method from Visualforce page directly and I'm not sure if this possible and I'm getting the following error below and with the code I have. Error Error: Unknown ...
Nick's user avatar
  • 6,934
0 votes
1 answer
1k views

Dynamic Describe Result

Schema.DescribeFieldResult field = Opportunity.StageName.getDescribe(); List<Schema.PicklistEntry> PL = field.getPicklistValues(); I am trying to do this:I want to replace field name ...
Salesforce Learner's user avatar