13
votes
How can I export object's field schema information to excel?
The best thing I came across is https://schemalister.herokuapp.com/. No installation required since it is hosted as a Heroku app.
10
votes
Accepted
Apex differentiate between Lookup field to master detail field
You want to call getRelationshipOrder() from your describe. It will be null for a lookup, 0 or 1 for a Master-Detail relationship.
9
votes
Accepted
How to check if SObject has certain field?
All the keys in the map are in lower case for some reason. I get a positive result for ownerid but not for OwnerId. I checked for our account object and all the keys in the map are lowercase.
This i ...
9
votes
Accepted
Apex differentiate between RichTextArea, LongTextArea and TextArea
Looks like theres 3 methods you can use to check the definition of a textarea:
field.getType() == Schema.DisplayType.TEXTAREA
field.isHtmlFormatted()
field.getLength()
Here's a snippet of these ...
8
votes
What is the best workaround for the 20 field history tracking cap?
@sfdc's method will consume a lot of Data Storage -- and that's expensive!
Do what @sfdc said but store the data in JSON in a Long Text Area Field on the record. Then build a Visualforce Page that ...
8
votes
Accepted
Is it possible to copy fields from Sandbox to Production?
Yes, you can use a change set to deploy fields from a sandbox to production. First, in your Production org, go to "Deployment Settings" and edit your sandbox's deployment settings to allow inbound ...
8
votes
Accepted
How can one validate 'recordEditForm' fields before submitting them to the platform?
Here's a way that you can achieve this. Let's say I have the component as below. There's a field for Title, which is hidden when the component is rendered (and your use case is to enable that). This ...
8
votes
Accepted
The length of the first and last names
A quicker way to do that is to use describe call in Apex.
System.debug(Contact.FirstName.getDescribe().length); //Prints 40
System.debug(Contact.LastName.getDescribe().length); //Prints 80
It also ...
8
votes
Accepted
How to iterate over all the queried out fields of a single record
You just need sObject.getPopulatedFieldsAsMap():
for(Object value: record.getPopulatedFieldsAsMap().values()) {
if(value == true) {
// We found a match
}
}
If you need to know which field:
...
7
votes
Accepted
Is there a way to see all recent changes in an org
Monitor Setup Changes
Setup Audit Trail tracks the recent setup changes that you and other admins have made to your org. Audit history is especially useful in orgs with multiple admins.
To view the ...
6
votes
Accepted
How to check that SObject field is present in SOQL query
There is a new method on sObject(as of Summer 16) for this:
getPopulatedFieldsAsMap()
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_sobject.htm#...
6
votes
Text Formula String Concatenation - Omit Trailing Comma
@AdrianLarson I used your suggestion for a similar solution and it worked for a year or so, until I was asked to include more Checkboxes (12 in all) in the formula, then I got:
Error: Compiled ...
6
votes
Accepted
How to edit the "created by" field for case attachments?
Take a look at this help article:
Considerations before having Create Audit Fields enabled:
Salesforce has the ability to set system fields through the API. When you are migrating data from an ...
6
votes
Accepted
Maximum Number of Fields in Data Extension
From inspecting the wsdl (the API schema), the maxOccurs for Data Extension fields is unbounded which implies that there is no limitation.
6
votes
Accepted
List of all objects with the current number of used custom fields
I'll convert this comment into an answer.
You can obtain this data rather clumsily with the Tooling API in the Developer Console. Enter the following in the Query Editor, and check the "Use Tooling ...
6
votes
Accepted
Accommodate the length of a string value to prevent the STRING_TOO_LONG issue
You can use the allowFieldTruncation header in the DMLOptions Class.
Order record = new Order(...);
Database.DMLOptions opt = new Database.DMLOptions();
opt.allowFieldTruncation = true;
Database....
6
votes
The length of the first and last names
you can check details about fields on Contact SOAP API guide
FirstName - The contact’s first name up to 40 characters.
LastName - Required. Last name of the contact up to 80 characters.
5
votes
Accepted
How do I get Last Modified Date of Particular field
Is this possible?
As Vamsi Krishna mentioned in a comment on your question, this is possible.
The two methods he mentioned are:
Enable field history tracking for the field (or fields) that you wish ...
5
votes
Accepted
Compatible Schema.DisplayType For SObject Put
As @KeithC mentions, Schema.SoapType is much simpler to work with.
Disclaimers
Maybe there's a simpler way than what I outline below. I didn't see the project through to completion so I can't ...
5
votes
Accepted
No such column 'Type' on entity 'LookedUpFromActivity'
If you look at LookedUpFromActivity object.
There is no Type field, instead you can use ActivityType or ActivitySubtype field
5
votes
Accepted
Only allow whole number in field
You could write a validation rule:
FLOOR(Field__c) <> Field
Keep in mind that normally, the system stores exactly what the user entered, despite not showing it on the screen. So, for example, ...
5
votes
Accepted
What is the best way to mass update the field labels of a custom object in Salesforce?
An IDE is arguably the easiest way to edit fields. Simply pull down the object, edit all the labels, then save the changes. You can do this in MavensMate, Force.com IDE, and others that support the ...
5
votes
Accepted
Automate the process of picklist values retrieval from the backend
I've already written an answer about this, but the question doesn't make sense to call it a duplicate, so I'll repost that code here.
// Wrapper class to provide label/value.
public class ...
5
votes
Accepted
How to access fields returned by Polymorphic query in apex/soql?
Here is an example of how to retrieve field values returned from Polymorphic query.
list<Event> newlist=[SELECT TYPEOF WHAT
WHEN OPPORTUNITY THEN StageName
...
5
votes
Accepted
SOQL SORTING WITH 2 FIELDS
Generally speaking, when I have a question, the first place I look is at the documentation.
Ordering by multiple columns is listed in ORDER BY in the SOQL & SOSL documentation (emphasis mine)
...
5
votes
Accepted
Send only udpated fields instead of all the field information
You can use the CDC (Change Data Capture) to get updates only on updated fields. You could also write manual code (Apex) to create a change delta, although this might require a lot of CPU time ...
4
votes
Accepted
Make contact firstname and lastname mandatory
Because this is a standard field, I don't think there's a lot you can do with this with respect to making them required fields.
A workaround would be to create a validation rule that checks whether ...
4
votes
Accepted
Better way for Bulk Assignment of Field Level Security
Don't know of any tools that do this, but I'd do one of the following:
Update a single profile via the UI to match the appropriate FLS, and then update the other profiles within the force.com IDE.
i....
4
votes
Accepted
View object fields and data
If you are talking about a quick select rather than typing all the fields, Workbench is the best tool for me. You can navigate into query > soql query and from below view you can select all the fields ...
4
votes
Formula based field in account instead of Roll-Up Summary
Using a formula field to count related records is not possible.
You have a few options:
Trigger to roll up in real time
Batch job to perform rollup
DLRS Package (Declarative Lookup Roll Up Summary)
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
fields × 518apex × 83
custom-field × 51
soql × 35
formula-field × 30
visualforce × 27
formula × 21
custom-object × 20
page-layout × 20
sobject × 20
object × 19
standard-objects × 18
metadata × 17
permissions × 14
administration × 14
account × 13
contact × 13
custom × 13
lightning × 12
api × 12
opportunity × 12
trigger × 11
visual-workflow × 11
picklist × 11
leads × 11