8
votes
Accepted
SOQL bug for null required-lookup fields?
This occurs because of an optimization during the "query planning" phase of a query. The query optimizer removes null values from filters on required fields. This optimization allows Salesforce to use ...
7
votes
Accepted
In order to check if a field is required or not, is the result of isNillable method sufficient?
First Approach -
For the field to be required it has to meet 3 conditions:
is Creatable
is NOT Nillable
is NOT Default on create
So your if condition should be as following:
if(field....
6
votes
how can i remove a required option on close date(opportunity)
See this:
Can I remove the required Close Date field in a new Opportunity?
The standard "Close Date" field cannot be removed from any Opportunity
Page Layout, nor can the "Required" property be ...
6
votes
Accepted
How to find required fields for an sObject?
Please note that fields can be made required via other means which are difficult or impossible to detect. Validation rules, triggers, and Process Builder can all introduce errors when a field is not ...
6
votes
Accepted
Why is the LastName field required for the contact? What is the best approach to import contacts that only have the first name?
As for the LastName being mandatory, I can only say that it's by design. And seems there were ideas to get it optional, but Salesforce doesn't have any plan to do so. So it is very unlikely we can get ...
6
votes
Accepted
Placing asterisk to to Lightning:input fields in LWC
You can use label-hidden variant and put label yourself:
<template>
<label>Middle Name</label>
<abbr title="required" class="slds-required">**</abbr>
<...
5
votes
Accepted
How to convert a lead owned by queue?
When converting leads owned by a queue, the owner must be specified. This is because accounts and contacts cannot be owned by a queue. Even if you are specifying an existing account or contact, you ...
5
votes
How to make a standard field to not be required
Standard required fields are required. You can't make them optional. I have heard of people making Visualforce pages to set those fields to some value "behind the scenes", but they're still populated ...
5
votes
Accepted
Dynamically get required fields with JS Remote Objects
I approach a similar problem in my SObjectFactory test utility with a RequiredFieldsCache, but you can adopt a somewhat simpler approach because you don't care about the values for a particular field.
...
4
votes
Accepted
how can i remove a required option on close date(opportunity)
As mention you cannot hide the field but you can change the label like you asked.
Setup->Customize->Tab Names and Labels-> Rename Tabs and Labels
Click [Edit] next to opportunities then click [Next],...
4
votes
How to make a standard field to not be required
If I'm not mistaken, the only required "standard field" on Account by Salesforce is Name. This must be a custom field. You can make standard (non required) and non-standard fields optionally required ...
4
votes
Accepted
How does SObjectType.newSObject() works?
It will simply instantiate a new empty Account object.
Required fields only come into play when you perform the DML. You will have to set those.
This and the describe classes are useful when the ...
3
votes
How does SObjectType.newSObject() works?
From the documentation:
Constructs a new sObject of this type
Basically:
Account newAcc = (Account)Account.sObjectType.newSObject();
is same as:
Account newAcc = new Account();
It returns the ...
3
votes
Accepted
apex:inputText required="true" doesn't work as in the documentation
You seem to be missing <apex:messages/> in your vf page. By definition, it says:
All messages that were generated for all components on the current page. If an <apex:message> or <...
2
votes
Accepted
How to ensure that article manager use specified values for custom article fields?
Creating a validation rule can very easily have the effect of making a field a required field. If that's going to happen, it's a good practice to mark the field as required in the page layout so a ...
2
votes
Required fields do not allow cancel
To add to the knowledge above, there is also a known issue with HTML-5 and commandbuttons which use "immediate=true":
https://success.salesforce.com/issues_view?id=a1p300000008YvNAAU
Even with ...
2
votes
Accepted
Can I edit or remove universally require standard fields in Salesforce?
We just implemented something like this for Opportunities - we didn't have a need for setting close date.
A URL Hack is what you are looking for. This allows you to prepopulate the required fields, ...
2
votes
How to test for Visualforce required fields in Apex?
Apex unit tests are good to test your controller logic. Unfortunately, there is no built in mechanism to test your UI layer in Salesforce (which is always a bit of a pain).
In addition, making the ...
2
votes
Accepted
Visualforce Required Fields and rerender
Try specifying immediate="true" on your actionSupport tag. Without that attribute, the visualforce page will try to submit the form to the server, which will trigger the page validation. Specifying ...
2
votes
Make custom field become required when certain condition is fulfilled
The Validation rule for this would be like below
ISPICKVAL(Type, "Other") && ISBLANK(Description__c)
2
votes
Make a custom field required when certain condition is fulfilled
While it's not possible to control field visibility on a standard page layout. You can have a validation rule (VR) to display a message, notifying them that the value is required:
OR(
AND(
...
2
votes
Compare field value to list of values in Visualforce 'Required' parameter
Just use a Set whitelist and add a Boolean property.
static final Set<String> whitelist = new Set<String> { 'option 1', 'option 2', 'etc.' };
public Boolean isAccountRequired { get { ...
2
votes
Accepted
Make field required on condition
You can use the rule like this...
AND(ISPICKVAL(PICKLISTFIELD__c,'Yes'), ISBLANK(MULTIPICKLISTFIELD__c))
Hope this might helps...
2
votes
Difference of data extension "required" and "nullable" attribute in marketing cloud?
As per the documentation
Primary Key - Determines whether the system considers field to be the primary key of the table
If you select this checkbox, the system requires that the value in this field ...
2
votes
Accepted
LEX Equivalent of Immediate = TRUE?
A immediate="true" solution is not needed in Lightning, because validation must be done by the developer, not the framework. Yes, the error appears automatically for you, but it won't stop you from ...
2
votes
How to find required fields for an sObject?
For API version <= 44.0, there is no explicit isRequired method but there are a few methods that you can leverage to find required fields:
for (Schema.SObjectField fieldToken : Schema.SObjectType....
2
votes
How to find required fields for an sObject?
Even though I'm not providing any answers to the original question, I want to add more information to this post that could be useful for others.
Apparently, the nillable field in the SObject Describe ...
2
votes
Accepted
Figure out which fields are required from Setup
As far as I know of, there's no way from UI to get that information.
But you can retrieve this information if you use Metadata API. You can use the attribute required on the CustomField metadata for ...
2
votes
Accepted
make a required field in VF page
When there’s a required field in a VF page and we submit the form, sever does a validation to make sure those have values populated. If there are no values form submission is rejected.
You may want ...
2
votes
Making Custom Field Required
You can make the field required:
At the "database level", by setting it as requiring a value in the Field's definition.
At the "page layout level", by setting it as required by ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
required-field × 105visualforce × 23
apex × 13
validation × 12
validation-rule × 10
custom-field × 8
required × 8
picklist × 6
page-layout × 6
lightning-aura-components × 5
fields × 5
javascript × 4
formula × 4
lightning-web-components × 3
api × 3
workflow × 3
aura × 3
sobject × 3
rerender × 3
lightninginput × 3
actionsupport × 3
fieldsets × 3
lightning × 2
unit-test × 2
community × 2