Questions tagged [custom-field]

A custom field can be added to standard objects that support custom fields and custom objects to extend the capabilities of Salesforce to suit the specific needs of an organization. Custom fields can be accessed in code by referring to them by their API Name which is their specified Field Name value suffixed with an __c.

Filter by
Sorted by
Tagged with
44
votes
5answers
32k views

How do I generate a random string?

How does one generate a random string sequence with Apex? I need to generate a code when a particular object is created in our Salesforce environment. I'd like the code to contain numbers from 0-9 ...
32
votes
1answer
24k views

Populating Custom Settings field using Apex

I'm trying to populate/set/put/initialize a custom setting's field with a calculated value within my apex code. The field type is number. Is there a way to do this?
15
votes
3answers
14k views

Finding if a custom field is editable using Apex code

I am reading the custom fields of a custom object Custom__c and then for each field I am inserting a new value: Public Custom__c custom1 {get;set;} Map<String, Schema.SObjectField> map = ...
14
votes
3answers
20k views

Why am I getting a not in package.xml error on custom fields when the custom object is in my package.xml?

Question Doing a deployment with ANT that includes some apex and a custom object. However, when I test deploy I'm getting errors about fields not being in the package.xml. Has something changed ...
14
votes
2answers
1k views

Is it possible to get the Standard Field “Name” increased form 80 characters lenght to a greater legth by Salesforce Support?

Is it possible to get the Standard Field "Name" increased form 80 characters lenght to a greater length by Salesforce Support via a case? I know, it's not possible changing this as an Admin. But I ...
13
votes
2answers
770 views

What is the logic for the automatic creation and update of “standard” report types for custom objects?

Question What is the detailed logic for when a "standard" report type is created/updated for custom objects or custom relationships? Background When custom objects and custom master detail ...
12
votes
2answers
4k views

Missing 'Required' attribute for Long Text Area fields?

Here is the snapshot for a "Text Area" field, notice that the "required" attribute is available i.e. we can set this field as required: Here is another snapshot for a "Long Text Area" field, notice ...
12
votes
3answers
9k views

How to access and not hardcode the field ID for a custom object? Using Apex, to construct URLs

Lets say you wanna create a new instance of a custom object, lets call this Custom Object Relationship_Detail__c. You are trying to create a link where it takes you to the proper RecordTypeId and it ...
11
votes
1answer
2k views

Can I create a polymorphic key from a custom object?

I'm creating a custom object that needs to be related to multiple other objects (but only one per record). I.e. via a ParentId field it could be related to a Opportunity, a Contact, an Account, or ...
11
votes
3answers
7k views

Metadata API Custom Field Permissions (how to automate this process)

We are using the Metadata API to add Custom Fields to the Account object in Salesforce. We are able to create the custom fields, but then the Salesforce user has to manually login to their account ...
10
votes
1answer
2k views

Use-Case for Encrypted Custom Fields and why are they rendered as input type=“text” and not as type=“password” on standard UI?

Can't understand why Encrypted Custom Fields are not rendered as type="password" on the standard UI. The first time you input or later if you change the content, it's just plain text. If you come back ...
10
votes
1answer
751 views

<deprecated>false</deprecated> randomly appears in object metadata in managed package. Why?

Sometimes when I commit the latests changes in my managed package to my version control I see those changes in the XML metadata of my custom objects. I heard that Salesforce.com is working on some ...
9
votes
3answers
13k views

Change field Data Type without removing all references to said field in Controllers and Classes

Is it possible to change a field's Data Type without removing all references to it in controllers and classes? I'm considering changing a Rich Text Area to a Long Text Area. I'm receiving the ...
9
votes
2answers
10k views

Country & State picklist as custom fields

Is the State and Country picklists available as custom fields? Can I define a custom field of type Country and use the 'built in' Country values?
9
votes
1answer
3k views

How to upload videos into custom object record

How to upload videos into custom object record like as photo upload in rich text field. no need to display a link i want to display a video
8
votes
2answers
7k views

Set Field Level security for profile using meta-data api

I am using meta-data api to create custom fields in java class. Now I want to set field level security for different profiles. First is it possible to set this with meta-dat api, If yes than how can I ...
8
votes
2answers
19k views

“No such column on entity” error for an existing custom field

I am trying to run a simple SOQL on a custom object: SELECT Id, Course_Link__c FROM Course__c But instead I am getting an error saying: SELECT Id, Course_Link__c ^ ERROR at Row:1:...
8
votes
4answers
12k views

How can I relate Activity to a second object?

Activity has a 'related to' field that links it to an object of various types. I need to link each activity to a Campaign, but also to an Opportunity. However Activity custom fields don't let me add a ...
8
votes
1answer
12k views

Custom link to download/export report in single click

I have a custom link titled Download on my Contacts page layout that when clicked currently takes me to the Export Report page with standard buttons Export and Done. I used the URL content source /...
8
votes
1answer
5k views

Difference between read only and visible

can some one please explain what is the difference between visible and read only in field level security while creating fields. I am very confused.
8
votes
1answer
3k views

Why are my default values always null for checkbox/boolean fields?

I setup a field in Salesforce: When looking at the metadata for my custom object containing this field, this is the data on that metadata field: "defaultValue": null, "defaultedOnCreate": ...
8
votes
1answer
8k views

Custom fields not useable in Approve/Reject Approval Request

I'm trying to get through my first SalesForce mod and it's definitely been a rocky path. I have one task I'm trying to do, but this section is holding me back. I have two custom fields. One a pick ...
8
votes
1answer
2k views

Maximum number of fields in a custom object, considering managed packages?

I am under the impression that a custom SObject can have no more than 500 (or 800) fields in total across all namespaces. From the Salesforce Features and Edition Allocations documentation there is ...
8
votes
1answer
208 views

How to Output Account Name Merge Tag with Dashes

When I use the account name merge tag {!Account_AccountName} to output the name of an account in an email message it shows up something like: Georgia’s Hair Salon. However, I'd like to somehow be able ...
7
votes
3answers
7k views

how to check thru code, if a field is referred / used anywhere in any of our apex code / vf page / component?

how to check thru code, if a field is referred / used anywhere in any of our apex code / vf page / component ? Assume I have a field called ApplicationNumber__c Say I have a list of apex classes :- ...
7
votes
1answer
2k views

Querying metadata - Find Custom fields created today

I am looking to find the "Custom" fields that were created "today" within an object in Salesforce.com. There are more than 500 fields on the object and the "Modified By" field in the schema is not ...
7
votes
2answers
6k views

Number Field - Limit Four Characters - Validation Rules

I'm having trouble enforcing a minimum character requirement on a Salesforce number field (using Validation Rules). I can get the limitation to work on a text field using: AND( ISBLANK(...
7
votes
2answers
2k views

Indexing Fields WITHOUT Salesforce Help (dates, etc)

I am asking this here because I'm having my usual run-around with Salesforce (we do not pay for Premium or "Developer" support if there even is such a thing) and I'd like to know if someone has ...
7
votes
2answers
2k views

How to remove a custom field from a managed package referenced in a custom report type?

Question Is there anyway to get rid of custom field in a managed package that has been referenced in a custom report type for that managed package? Background I've built a managed package and for ...
7
votes
3answers
577 views

Data Not Available? Can't edit a custom formula field formula

Any ideas why I would get a "Data Not Available" error when editing a custom field? In this specific instance I'm editing a formula field, and I'm able to edit and save changes to the description and ...
7
votes
1answer
6k views

How to change a field type and deploy when field is referenced in code

I have a custom field on the user object that I need to change from Field Type Text to Field Type Multi-Picklist. The field is referenced more than 500 times in 25 Classes, Triggers and VisualForce ...
7
votes
1answer
743 views

How can I identify a deprecated managed package custom field via the APIs?

I'm in the process of doing some development in a random1 client org where they want an integration with another parties managed package. Part of this is to run SOQL queries against custom objects ...
6
votes
3answers
589 views

Get list of unused picklist options

I have a custom object with a picklist field with a very large number of options. In an effort to reduce the number of choices, I want to find (and remove) all the options in this picklist which are ...
6
votes
2answers
342 views

Profile field visibility

If two users are sharing same profile, how can we make one field visible to one user and hiding it from other user.
6
votes
3answers
3k views

Search for a field in all objects

I am looking for a field named "Owner_c" in all Objects. Any easy way to find it through work bench or a query in Developer Console.
6
votes
2answers
1k views

Lookup Filter “OR” Condition

I would like to start using a filter on one of our lookup fields. The lookup field is simply a lookup to a contact. However, I need the filter to have an OR condition (e.g. only allow contacts from ...
6
votes
4answers
12k views

How can I add a new value to a picklist using APEX?

I have queries pulling all of the information correctly but what I can't seem to find was a way to add new options to a picklist using APEX. I currently have Package__c.Products__c.add(new Schema....
6
votes
2answers
2k views

How to prevent duplicates when using date field?

I have a very simple custom object with just two custom fields, a dropdown yes/no and a date. This custom object serves as a related list for account and should get multiple entries with the ...
6
votes
2answers
10k views

Can I add a field to the Attachment object (specifically a picklist to track the 'type' of attachment)?

The title says it all. I would like to add a field to the attachment object to be able to sort/filter based on the attachment's type (eg, 'Will', 'Account Opening Document', 'Correspondence', etc.). ...
6
votes
1answer
2k views

Check if a record exists without knowing its type

I am trying to have a custom object link to other objects without specifying a type. By that I mean I want to make something like an "OtherObject" lookup without specifying the type, so that I can ...
6
votes
2answers
3k views

Junction object fields

I have created a many to many relationship between two objects, A and B, using a junction object. That works fine, and the related lists show up on A and B with standard layout pages. Is it possible ...
6
votes
2answers
1k views

How to check if a field is used in multiple object

I have lookup field for country in many object is it possible to check in one place in Salesforce in how many object this field is being used
6
votes
1answer
91 views

Is it possible for an AppExchange package to create a custom list of custom fields?

We have an AppExchange package that would ideally create a different set of custom fields for each customer, depending on configurations that either the customer sets at package installation time or ...
6
votes
1answer
3k views

Creating a custom field from a SOQL query

We have a custom Object and our Opportunity objects have a Lookup field to the Object. However, when we go to add a Roll-up field to Object that shows the total Opportunities attached to the Object, ...
6
votes
2answers
1k views

Not all records returned in SOQL Query

I have a query that I'm using to export data: SELECT c.Id, c.SystemModstamp, ... FROM Contact c WHERE c.SystemModstamp > start AND c.SystemModstamp < end AND c.Id > string ORDER BY c.Id ASC ...
6
votes
1answer
1k views

Prevent Automatic Hyperlinks being created for Text Area Fields

I have a custom object with a Long Text Area field to store a string that may be longer than 255 characters. The contents of this string often includes text that looks like a hyperlink, but is not ...
5
votes
2answers
4k views

How do I set the startpoint for an autonumber after field creation?

Just as the title asks, how do I set the startpoint for an autonumber after field creation? The field is an external Id and to avoid conflict with the external system, I need to move the id up a few ...
5
votes
3answers
1k views

Field accessibility not deployed through change set

While deploying through change set, I have added one custom field (checkbox) whose field accessibility has been changed. After deploying, the field accessibility has not been changed in the target ...
5
votes
1answer
1k views

Access fields dynamically in a trigger

I need to use dynamic fields in a for loop so that i can pick up the values from different field on insertion of an object accordingly. Below mentioned are the fields which needs to be dynamically ...
5
votes
3answers
3k views

How to get the entity ID for a custom field in Apex?

I am looking for a way to get the 15 character entity ID for a custom field on my Lead object in an Apex controller. I have tried this: private String getEntityIdFor(String fieldName) { Map&...

1
2 3 4 5
18