Schema is a tag used to describe questions related to the dynamic processing of the system schema through the various describe methods.

learn more… | top users | synonyms

3
votes
1answer
53 views

How to get SObjectType for a given Schema.SObjectField?

I have Schema.SObjectField field = MyObject__c.myField__c; Schema.SObjectType objectType = getTypeOf(field); how would getTypeOfField() need to look like for this to be true? ...
1
vote
2answers
53 views

compare fields values for a controller, no trigger, Schema.DescribeSObjectResult?

I'm trying to find out how to compare fields values for changes. I have for custom fields that I need to know if they have changed before the user clicks on Save to run a logic before saving. This is ...
2
votes
1answer
36 views

Contact.LastModifiedById.getDescribe().isCreateable() returns true

How is it possible that the following code can return true Contact.LastModifiedById.getDescribe().isCreateable() It was my impression that the LastModifiedBy field was never createable
4
votes
2answers
50 views

Can you Access Workflow Rule attributes through Schema?

I need to load the attribute information about a Workflow rule into a custom object. I need the description, criteria, evaluation rule, and anything other detail about the workflow rule. Does anyone ...
8
votes
6answers
478 views

Bug with force.com IDE/Eclipse plugin with Spring 14 org's only

On two of my sandboxes I am getting an error every time I open a class or try to open the schema (the classes load but the schema does not). Other org's are working fine but these two, which are from ...
2
votes
2answers
64 views

Test if a field is available on arbitrary SObject record without using Describe calls

I have many Custom Objects in my package that have a common custom field Version__c. One part of my app serializes and deserializes records to/from Json. While deserializing I want to change this ...
9
votes
1answer
344 views

Getting “__r” relationship name from Schema.SObjectType.Fields

Say I have a master-detail relationship between two objects, Schematic__c and Part__c. I can SOQL query the master from the detail: [SELECT Schematic__r.Name FROM Part__c] If I'm building a query ...
12
votes
5answers
354 views

MavensMate/Sublime Text - how to investigate schema

I'm going through an evaluation of MavensMate and Sublime Text as a replacement of Eclipse IDE. Everything is working well and is a great alternative to Eclipse which is clunky and slow. The main ...
3
votes
1answer
1k views

Schema.getGlobalDescribe and “Invalid field LastReferencedDate for Account”

I am using this code to print out Account fields to PDF file . Programm fails when it tries to retrieve "LastReferencedDate" from the instance of account object. It fails with ...
2
votes
1answer
58 views

Fetching group Ids from OpportunityShare

I want to fetch all group Ids from an OpportunityShare table for a particular opportunity. I intend to do this by comparing all the Ids in UseOrGroupId column in opportunity share table against key ...
3
votes
1answer
1k views

How to get salesforce Ids for fields from apex using Schema methods?

I tried this approach, but the Salesforce Id is not being returned by getDescribe method. Schema.DescribeFieldResult field = Schema.SObjectType.Account.fields.Name; system.debug(' Account field, ...
2
votes
1answer
115 views

FeedComment Parent relationship

I have triggers on FeedItem and FeedComment where I need to dynamically read a field on their respective Parents (ParentId). For FeedItem I can do (for example): FeedItem.Parent.get('Name'); But ...
6
votes
1answer
257 views

Can I tell which fields are present in an sObject variable?

Is there a way to retrieve the list of fields in a specific instance of an sObject? That is, not all the fields that are defined on that sObject, but those fields which are populated on a particular ...
3
votes
1answer
53 views

Why are fields named differently on the child relationship entity vs the actual child object?

ProcessInstance has a child relationship with ProcessInstanceHistory. This relationship is called StepsAndWorkitems. Here it is in Eclipse's Schema Browser. Now, let's examine the actual child ...
7
votes
3answers
617 views

How should I build custom history tracking for a large number of fields?

I have a custom object where I need to track data changes to a lot of fields for regulatory reasons, far more than the maximum of 20 fields for standard history tracking. (Actually Salesforce ...
4
votes
0answers
121 views

Why is KnowledgeArticleVersion not in Schema.getGlobalDescribe()?

It's a bit inconvenient that this returns null: system.debug( Schema.getGlobalDescribe().get('KnowledgeArticleVersion') ); While this does not: system.debug( ...
4
votes
1answer
154 views

Are Field History tracking objects the only Salesforce objects that have fields of DisplayType “ANYTYPE”?

Field History tracking objects, such as "AccountHistory", "ContactHistory", etc., keep track of changes to field values on records of objects with History tracking enabled on those fields. The ...
0
votes
1answer
246 views

How to get fields in deeper object tree levels with reflection

I'm constructing a dynamic query to get some fields from the database. I use a root object for that purpose and branch out from it. My_Custom_Object__c -> Account__r.Id So if I want to get an ...
4
votes
2answers
1k views

How to find only those Schema.SObjectType types that are visible in the Schema Builder

I can find a map of all String -> Schema.SObjectType types by invoking Schema.getGlobalDescribe(). However, that includes a lot of object types I'm not interested in (like casecomment, ...
9
votes
8answers
1k views

Does Schema.GetGlobalDescribe() Account for Prefixes?

It seems to me that in my dev org at least, the keys for the map returned by Schema.GetGlobalDescribe() do not use namespace prefixes... so does anybody know what happens when there are two objects ...