Questions tagged [default-value]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
23
votes
2answers
2k views

Does 'default value' do anything if the object is created through Apex?

I created a currency field on OpportunityLineItem that has a default value set to 0.00. In my test method I create a record and insert it. I then query it back out and try to assert that the field is ...
8
votes
2answers
9k views

Define APEX method with default arguments

I am curious if APEX permits declaration of default arguments (or parameters if you will). When calling the method without specifying the value, method would be executed with the default value, ...
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": ...
7
votes
2answers
6k views

Set default value for method inputs

How do you set a default value for a method input? public void myMethod(String input1, String input2); I would like to allow people to only need to state one of the inputs if they want (and have ...
6
votes
2answers
7k views

How to render VisualForce components based on default values

I am trying to render one component based on whether another one has a specific value set on a Visualforce page. Using the following, it works fine EXCEPT on the initial load (i.e. once I start ...
6
votes
4answers
10k views

Setting Default picklist value on loading of Visualforce page

I have designed a VF page to create a new record in which I am trying to display the value of a pick-list field. I have set a default value for this pick-list field. When trying to create the record ...
5
votes
5answers
2k views

Auto populate picklist when creating a opportunity

We have a country and district text field on the User object. We have country and district pick list field on the opportunity object. When a user creates a new opportunity, the very first time, we ...
5
votes
2answers
8k views

Setting default field values in apex for new objects

We need to set some default values in apex on a custom object before it is created. The user should ideally work with the standard object page - we don't want to re-create the whole page in ...
4
votes
1answer
3k views

Visualforce: Control checkbox's default value

So I'm trying to Embed a VF page on my Incoming_Payment__c object, that will allow connecting a few opportunities to it. I want to: Show all opportunities related to the same account (Works!) 2. If ...
4
votes
2answers
293 views

SObjectType.newSobject(null, true) doesn't populate default values if called in vf action method, any tips?

I'm trying to create an sObject instance using following code: Schema.SObjectType targetType = Schema.getGlobalDescribe().get(objectName); sObject sObj = targetType.newSObject(null, true); This ...
4
votes
0answers
349 views

Datetime field default `now()` causes “value not of required type” error?

Per this answer, and everything I know about Salesforce formulas, if I want the default value of a datetime field to be the current time, I should be able to use the formula now(). In this case, the ...
3
votes
3answers
14k views

Setting default value for datetime field

What format do I need to enter when setting a default value when creating a datetime field?
3
votes
1answer
90 views

Any way to include a new line in a field's default value?

I would like to default some JSON including new lines: [{ "text": [...] }] in a LongTextArea field: <?xml version="1.0" encoding="UTF-8"?> <CustomField xmlns="http://soap.sforce.com/...
3
votes
2answers
545 views

Time field doesn't show time with AM/PM properly when use default value

I am trying auto fill time field while creating new record. my field as here what i want to show but i am getting like this my field data type is time i am using default value
3
votes
2answers
11k views

How can I set the default Value on a custom SelectOption List?

The Following works good to retrieve my account list in a SelectList on my VF. But I'm trying to set a specific Default Account as the first value in the list - Now it shows up last.. *Is there any ...
3
votes
2answers
6k views

Default value in selectOption not getting rendered on VF page, but is correct on controller

My product variable is getting set correctly in the controller - but fails to render correctly on the VF page. This is just a snippet, but there is a LOT going on on the VF page - so that may very ...
3
votes
1answer
4k views

Default sort order of the records in SOQL [duplicate]

I queried SELECT Id, Name FROM User LIMIT 10 It generates list of 10 users in some order randomly. On what basis does Salesforce give these 10 records? Ordered by CreatedBy ASC? DESC? Name ASC? ...
3
votes
2answers
5k views

Default a Date field to FISCAL YEAR start/end when a record is created without using Apex triggers

I need to set a Date field on an object to the organization's Fiscal Year's Start Date. This could be a formula field, but ideally it would be just a Date field so that the value could be modified if ...
2
votes
3answers
873 views

What does DescribeFieldResult.getDefaultValue actually return?

So in the documentation for the DescribeFieldResult.getDefaultValue method, it says: Returns the default value for this field There is a related method called getDefaultValueFormula whose ...
2
votes
3answers
6k views

UPDATE … Default Value in a lookup field

I'd like to create a trigger that automatically assign a value to a lookup field. I've tried to emulate what I've read on these 3 posts (but without success) https://developer.salesforce.com/forums?...
2
votes
2answers
179 views

Why does my newly created Account object in a Unit Test not have the expected field default values?

I created a field on the Account object called In_Negotiation__c, it's a picklist with options 'True' and 'False' with a default value of 'False'. (Yes, I know it would make more sense to have it be ...
2
votes
5answers
3k views

Set default value on children records when `New` is clicked on related list

One of the custom objects I have is rendered as a Related List of Opportunity. This custom object also has a custom field of Opportunity lookup type. To create a record of this type I go to ...
2
votes
1answer
1k views

How to load default values in skuid model?

Question When I'm creating a new object in the Skuid page is there anyway for the model to pull in the defaults values for the object? For example, if I've set the default value for the field, ...
2
votes
1answer
2k views

How to add a string value to string array lightning component

I am fetching some recordtype values as a string array. I want to add the string -- None-- to the array so its obvious nothing is selected by default. How do I achieve this. I tried the following but ...
2
votes
1answer
500 views

Detect when user clicks cancel on createRecord modal

I am using sforce.one.createRecord() on a visualforce page. The visualforce page is then used as the override on the New button for a custom object. This works fine, except that I need to redirect the ...
1
vote
3answers
2k views

Default value for date field

I have created a new date field and set the default value to 'today()'. The date value is being shown for all the new records that are created after the creation of this date field. But the old ...
1
vote
4answers
8k views

How to set a picklist default value?

How can you set a default value for the following field on Opportunity? Field: Stage Default value: "Stage 1 - Qualified"
1
vote
3answers
564 views

How do you set default Lightning attribute value from a Custom Label?

I'm trying to set Attribute Default Value from a Custom Label. I tried setting Custom Label in Attribute default Value in a Custom Component. e.g. <aura:attribute name="attributeFromLabel&...
1
vote
1answer
442 views

Is there a way to query all fields on an object that have 'Default Value' ticked (and possibly filled in)?

Is there a way to query all fields on an object that have 'Default Value' ticked (and possibly filled in)? This should include custom fields.
1
vote
1answer
33 views

Getting an option as default value in a lightning-combobox component

I have a lightning-combobox component, that gets options from a javascript method. What I am trying to do is to get one of those options, as default value in the html component. Javascript method is ...
1
vote
2answers
73 views

Default values in Object fields are not available in instantiated object, A workaround

Had an issue getting Default value of a Custom object field (Picklist) automatically when the object is instantiated in controller class. Below worked for me. InstantiatedObject.Field = (...
1
vote
1answer
1k views

Input type Checkbox attribute Checked is not set on load in ampscript

I have a checkbox in the page. It should be checked if the original value is True. I'm trying to implement ampscript for this, but it fails. Even it doeesn't show in the Preview. I debugged, the ...
1
vote
2answers
2k views

Assign selected picklist value as a default value to my Text field?

I want to assign selected picklist value as a default value to my Text field. I am having a Select_Option__c field on Lead and a Enter Detail text field. I also want to add the selected value of ...
1
vote
1answer
917 views

Overriding Standard 'NEW' button using Visualforce or Creating custom button and replace standard button

Using a Before trigger/ Workflow has not helped me fill in or provide a default value to a standard field(NAME) while saving a new record. I was asked to build a Visual force page and then override ...
1
vote
1answer
29 views

Set Text 'Not Attempted' in Date field

Is it possible to input a default 'text' to a Date Field. which will change to a date as soon as the person attempts something
1
vote
2answers
918 views

Change the label of “none” value of a picklist

I had a generic question. can the "none-" value of a standard picklist be changed to something else like "default" or "select" etc. What I want here is that, I want the default value to be present, ...
1
vote
1answer
52 views

Undefined default value for custom accounts fields

I have a custom field in accounts section of salesforce. As far as I have seen under its configuration, there is no default value set for this field but whenever a new account is created, the value is ...
1
vote
3answers
3k views

How to set the default record type for Content Version in the Enhanced Profile User Interface

In the original Profile User Interface this is obvious: Go to the desired Profile Find the section called ‘Standard Record Type Settings’ Look for the label ‘Content Versions’ Click [Edit] and select ...
1
vote
0answers
184 views

lightning:inputRichText defaults to 'Salesforce Sans' style and '12' size of text even when the selected text has a different style and font

In a Lightning component Rich Text area, selecting text style and size always defaults to Salesforce Sans and size 12. Input some text into the editor then try to change the font style or size. See ...
1
vote
2answers
1k views

how to remove default subject value “Call” from log a call button from activity history?

I want to remove the default subject value "Call" from the 'log a call' page from activity history section on case page. Could it be possible? Thank you. Thanks, Anitha
1
vote
1answer
868 views

Setting a default TIME value only, on a Date/Time field

We have a Date/Time field on a custom object which lets us choose the date (perfect!), but defaults the time as 12:00:00. We want it to default to 09:00:00. I tried to go and change the default ...
1
vote
0answers
462 views

Set Default Value of a data Extension column using FUEL SDK

I am using FUEL sdk to create Data Extensions. I want to set the default value of a column which is a DATE data type to Current Date. ET_DataExtensionColumn de_col_insertdate = new ...
1
vote
0answers
332 views

Dynamcially referencing an component attribute in default attribute of type=“object[]”

What is the correct way to default another attributes when declaring object[]? This: <aura:attribute name="foo" type="object[]" default="[ { 'title': 'Account Name', ...
1
vote
0answers
394 views

How do I set the default display for the Calendar?

Using Lightning '17 - is there a way to set the calendar to default to the monthly view?
1
vote
0answers
827 views

Prepopulate Name and lookup field value from related list new button

On a custom object, I've managed to auto populate the custom object's name field to a default value using below custom vf page code: <apex:page standardController="CustomObject__c" recordSetVar="...
1
vote
0answers
54 views

Set default date-Value using the result of my trigger

I using a trigger to caluclate the min date regarding other custom objects an everything works fine. But I would like to fill the field "Gültig von" after pressing the Button "New Object" with the ...
1
vote
0answers
56 views

How to set a default Account within a contact record for a user profile?

I am wondering if there is a way to set the default Account ID within a Contact record for a specific user profile? I have tried workflow rules (doesn't allow field updates against lookup), I ...
1
vote
2answers
547 views

Change the Default Role when Adding Contact Roles to Opportunity

I am new to being a Salesforce admin, and am going to a few classes in the coming weeks. Currently I am trying to find where to set the default value for Contact Roles when adding them to an ...
1
vote
2answers
3k views

It is possible to create a custom text field with default text defined?

we need to include some explanation text related to some custom field in order to provide to the user the meaning of these fields and how it must to be completed. We have test with the help text ...
0
votes
1answer
39 views

Initialize fields from an object when creating the object

Is there any elegant way to create a new record with its default values in apex for all its fields?? Example: 1-I have the object Car__c with the fields Color__c, Model__c, Brand__c, Type__c, ...