Questions tagged [describesobject]

Salesforce allows you to describe sObjects either by using sObject or field tokens, or the describeSObjects Schema method.

Filter by
Sorted by
Tagged with
1
vote
2answers
46 views

How to get the local object from a string in the managed package?

Our managed package has a namespace, say DemoApp, and a custom object named Form__c, the client's org also has a custom object Form__c According to the doc here: https://developer.salesforce.com/docs/...
0
votes
2answers
43 views

How to Describe a SOQL Query

I am trying to write a utility to export a SOQL query to a POCO / POJO, and it works so far using the describe API on the SObjects. Is there a way to directly describe a specific SOQL query, including ...
2
votes
0answers
51 views

Best way to get the custom object type of a WhatId in a Flow

I'm working on a Task record-triggered flow and I need to evaluate the WhatId to see what the object type is. As I see it's not directly available. I'm wondering if what the best solution would be. I ...
1
vote
1answer
53 views

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> ...
2
votes
1answer
55 views

Describing the default Person Account record type using Apex

Using the RecordTypeInfo class allows us to get information about the Record Types and which one is set to default for the running user's profile. The (Person) Account is however a special case, ...
0
votes
2answers
108 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 ...
0
votes
1answer
29 views

try/catch vs describe calls inside for loop which has more performance impact?

We have a generic method which is called in a for loop for each record where we try to get a value of a field using Sobject get method. Before getting the field we have to make sure that field ...
0
votes
2answers
40 views

How to retrieve Apex class (Not sObject) fields in apex dynamically?

I have task to test fields from custom class and i need to find all the fields are exist and return expected data. ex: Class Person{ String Name {get;set;} integer Age {get;set;} } //in ...
1
vote
1answer
32 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 ...
1
vote
1answer
24 views

Apex: How to figure out actual sobject that has been queried having only AggregateResult type

To narrow down the problem - we have a method like this: private static Object doSomeProcessing(List<AggregateResult> records) { ... // need to add additional logic here based on sobject ...
3
votes
1answer
41 views

Describe vs EntityDefinition for non-active features

Is this supposedly a bug? Have anyone came across this already? Asking because I was under the impression both should have the same behaviour. I tried to use a query against EntityDefinition instead ...
0
votes
2answers
161 views

Get all Sobject Label and API name in Ascending order according to the label

Is there any standerd methord to get all Sobjects name in Ascending order. I am able to get all objects label and API name by the following code. I need to put all the names into map in ascending ...
4
votes
1answer
199 views

How do I tell if a custom metadata type field is a Field Definition?

I have the following code: public static void getFields(){ SObject obj = (SObject) Type.forName('Health_Cloud_Integration_Settings__mdt').newInstance(); DescribeSObjectResult describe = obj....
0
votes
2answers
2k views

How to List all Custom Objects from Salesforce API?

I'm currently working to use the Salesforce REST API to get a list of all Salesforce Custom SObjects without including System or Standard Objects (like how the /services/data/vXX.X/sobjects/ does). ...
0
votes
1answer
249 views

How to get last created record date of all custom objects having total number of records greater than 1 lakh

My requirement as part of org analysis is to get list of all custom objects having more than 100000 records and created date of LAST CREATED record. My tries are as follows:- Go to Setup - Storage ...
3
votes
0answers
53 views

Are individual object describe calls expensive enough to justify static cache? [duplicate]

Supposing we have a method that executes logic dynamically depending on the SObject type like the following one: public class TestDescriber { public static void callMeManyTimes(SObject record) { ...
0
votes
2answers
60 views

SOQL statements cannot query more than 20 different child types error

I have the following piece of code public static void fetchRelatedRecords(String primaryRecordString){ SObject primaryRecord = (SObject)JSON.deserialize(primaryRecordString, SObject.class); ...
1
vote
1answer
896 views

How to get child relationship name from Parent Object in Apex

In the following piece of code, i am trying to do a dynamic parent - child query public static void fetchRelatedRecords(SObject primaryRecord){ String recordId = (String)primaryRecord.get('Id');...
2
votes
1answer
1k views

How do I get the RecordTypeId for a Person Account using Describe method?

I can get them by running the following query SELECT Name, SobjectType, IsPersonType FROM RecordType WHERE SobjectType='Account' AND IsPersonType=True or by doing public Id ...
1
vote
0answers
34 views

getDescribe Failing on Individual Object Id in Tests (Data Protection and Privacy)

My tests of methods using dynamic SOQL queries stopped working after enabling Data Protection and Privacy. I receive the following Exception: FATAL_ERROR caused by: System.SObjectException: Field ...
0
votes
1answer
46 views

List of fields and whether or not they are Encrypted And tracked in Field history

I have been wracking my brain trying to figure out a way to get a list of fields and include whether they are encrypted, and whether they are marked for field history tracking. I seem to be able to ...
1
vote
2answers
175 views

Is there a way to check if an object is the actual object visible in the objects tab in an org?

We have need to run through every object in an org to determine which ones have certain fields our app needs. We ONLY care about the actual objects (case, campaign, contract, custom objects, etc...). ...
0
votes
1answer
131 views

Most efficient way to get all child records for a specific record

I have an account record that I want to get every single possible child record - ideally as a list of IDs. Currently I am doing the following: for(Opportunity opp : [SELECT ID From Opportunity ...
3
votes
1answer
70 views

Is Contact othergeocodeaccuracy a legitimate field?

Many of our Continuous Integration builds just failed with hundreds of this error: System.QueryException: No such column 'othergeocodeaccuracy' on entity 'Contact'. Our code does describe calls ...
5
votes
1answer
188 views

Any way to get Child Relationships without being bound by user permissions?

Question User object-level permissions limit the results of DescribeSObjectResult.getChildRelationships(). Are there any workarounds? I have submitted an Idea about this (https://success.salesforce....
0
votes
2answers
182 views

Prevent other fields which is part of managed package

Retrieve all fields for particular sObject it is working fine but then i insall app which is part of manage package also retrieving fields of manage package. how to prevent to retrieve. objects/...
1
vote
1answer
268 views

How to access Owner field using getDescribe().fields.getMap()

I have a below code to access owner field from sObject. Map <String, Schema.SObjectType > sObjects = Schema.getGlobalDescribe(); Schema.SObjectType targetType = sObjects.get('...
0
votes
0answers
159 views

Objects not in getGlobalDescribe() (Scorecard, ScorecardMetric, ScorecardAssociation)

i am confused why the objects Scorecard, ScorecardMetric, ScorecardAssociation arn't listed in the getGlobalDescribe() Map. Documentation (https://developer.salesforce.com/docs/atlas.en-us.apexcode....
1
vote
1answer
881 views

Determine if User is System Administrator without a query

has anyone found a way to check if the current user is a sysadmin without consuming a query? Seems like something that should be easily determined using Describe but haven't seen a solution to this. ...
11
votes
2answers
488 views

Apex method to find out if SObject is a setup object

Regular SObjects and Setup Objects can't be mixed in DML otherwise you'll experience a Mixed Dml Exception. How can Apex code find out if a given SObjectType is such a setup object? System.assert(...
10
votes
1answer
313 views

Drawbacks of using SObjectField.toString() over SObjectField.getDescribe().getName()

I often do '' + field where field is an SObjectField to get the field's API name. I like that much more than the clunky verbose field.getDescribe().getName(). So is there a reason I should not do it ...
1
vote
2answers
167 views

Is there a way to determine if an object supports list view?

Is there a way to determine if an object supports list view? I've developed a VF page which shows a list of Objects and based on Object selection it shows list views of that selected object. For some ...
0
votes
2answers
48 views

Type safe access to SObject ChildRelationships describe

To access an SObjectField you can use Account.Field_Name__c. This has the advantage of being checked at compile time. Is there an equivalent syntax for ChildRelationship? Account.Contacts does not ...
1
vote
1answer
208 views

sobjects describe label displaying a different label

I'm using the toolkit for .net and am making a soobjects/{type}/describe request to get the fields for a given entity. See code for "DescribeAsync" in https://github.com/developerforce/Force.com-...
0
votes
1answer
526 views

Using Describe to return single field result

I wrote a generic method that takes an object, field and value as string parameters and returns the picklist label. I was wondering if there is a more efficient way to write the method instead of ...
5
votes
1answer
133 views

Impact of Shield Platform Encryption on describe calls?

Some old code was obtaining information about record types by querying the RecordType object. But now that the RecordTypeInfo describe API includes the record type developer name, we have changed the ...
0
votes
1answer
32 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'...
0
votes
1answer
317 views

How to get related objects and fields of a parent object dynamically?

Can any one suggest me how I can get related objects and their fields of a parent object.Here is the code I have tried so far: public void discoverRelatedAccessibleFields(sObject newObj) { ...
2
votes
2answers
770 views

Partner API describeSObject on Contact fails with “Instance validation error: 'urn:address' is not a valid value for soapType.”

We're trying to pull down picklist values from the Contact object to show on an ASP.Net page using the Partner API. However, we receive the following error when the describeSObject call is made. "...
0
votes
0answers
330 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 ...
0
votes
2answers
2k views

getSObject - Dynamically Referencing Object Fields from Map

I have a Map of IDs of a custom object (scopeAccountMap). I am iterating through each object in scopeAccountMap and I am creating a map of the fields for each of these objects. I am receiving the ...
5
votes
1answer
3k views

Dynamically retrieving page layout fields

Is it possible to dynamically retrieve the fields on a certain layout? Possibly through something like DescribeLayout()? I'm having trouble finding examples on how to build a lightning component with ...
2
votes
1answer
66 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 ...
2
votes
2answers
397 views

Check from Apex if object supports custom fields

In Salesforce there are some specific objects like Attachment, RecordType etc. which are 'closed', i.e. we cannot create custom fields on them, in opposite to 'open' objects, e.g. Account, Contact etc....
1
vote
1answer
156 views

describeSObject for Individual object

Is it possible to call the describeSObject method for the Individual object?I am using the Partner-Connection-API com.sforce.soap.partner.DescribeSObjectResult describeSObject(java.lang.String ...
0
votes
2answers
2k 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 ...
4
votes
1answer
3k views

How to present state and country picklists with dependency logic in a Lightning Component?

It's not too hard to present the Contact/Account state and country picklists themselves, but the dependency filtering where when you select "United States" as the country only the 50 or so relevant ...
5
votes
1answer
252 views

Get list of “first-class” Salesforce objects

I'm working on a managed package that will allow users to select an object in their org and create a mapping with an external service. I noticed that Schema.getGlobalDescribe() returns a plethora of ...
2
votes
3answers
2k views

To find Custom objects inside apex

I want to check whether a given object is standard or custom. At present I have a method which identifies custom objects but that is taking too much CPU time, which leads to salesforce exception. ...
3
votes
2answers
2k views

'System.LimitException: Maximum stack depth reached: 1001' Error message

What is the meaning of the error message: System.LimitException: Maximum stack depth reached: 1001 I am trying below code, and on previewing the page from 'Developer Console', this error appears. ...