You need to sign in to do that
Don't have an account?
Banti
Date field to Text field
Hi,
I have date field , suppose i am selecting 4/3/2013 in date field
i have 3 more fields
Date( text)
Month( Picklist)
Year( Text)
i want to auto populate date field value in to these 3 fields by date,month, year
how can i do this, any help will be appriciated
Thanks in Advance.
Banti
Hi ,
In that Case Dont take it as a Picklist , Take it as a Text and in the Workflow Formula use CASE(expression, value1, result1, value2, result2,...,else_result) . It should provide you with your answer. It should be somewhat like .. CASE(MONTH(Date__c ), 1, 'January', 2, 'February',3,'March',4, 'April',5, 'May',6, 'June',7, 'July',8, 'August',9, 'September')
Hit Kudos if this is or previous message was useful to you . If you find this as a solution to you question then mark it as a solution .
Thank You
All Answers
You can use Standard Date methods date, month and year to retrieve date, month and year respectively.
Then you can use the retrieved information to use in your 3 other fields.
not understand, can you post a sample for retrieve date
Date myDateInstance = Date.today();
System.debug('--This is actual Date=== ' + myDateInstance);
//Now use date methods to retrieve
//Date
Integer myDay = myDateInstance.day();
// Month
Integer myMonth = myDateInstance.month();
// Year
Integer myYear = myDateInstance.year();
System.debug('Day=== ' + myDay);
System.debug('Month=== ' + myMonth);
System.debug('Year=== ' + myYear);
Please note that all above values are of Integer type so you need to change them to String before assigning to the 3 fields. AND for month picklist you may have to check what value you are using. If its not number i.e. it is Month Name, JAN, FEB etc then you need to convert the myMonth number to Name accordingly.
-Prafull
Hi
If you are using visualforce page then you can do in get the Day , Time , Year using the Date Methods you can easily get through . Click Here for Details about Date Methods.
Moreover, if thats a standard page you need to alter adjust your schema a bit .You will get the fields after the reocrds are Saved. Make all of Day , Month and Year Field as "Number" Datatype
For this ...
1. Create a Workflow on your custom Object with entry criteria "Test Object: DateNOT EQUAL TOnull"
2. Add 3 Email Alert for each of Day , Month , Year and in their "Evaluate to Formulaes" write
a Formula Value MONTH(Date__c ) For Month
b Formula Value YEAR( Date__c ) For Year
c Formula Value: DAY( Date__c ) For Day
3. Activate the Process and as soon as you Save a record you will get those values
Note : An after Update Triggers can be an equivalent answer to your question if you want the name of Months also to appear .
Important :
Please mark this as an solution if this is seems to provide you useful information and hit Kudo's .
Hi Gautam sing,
i put field updates for each field, i,e Day, year..working fine
but how can i put for pick list (Month) .?
here is the options for pick list field update
1)The value above the current one
2)The value below the current one
3) A specific value
based on Month from date field i want to populate Month in Month Pick list, how can i.????
Hi ,
In that Case Dont take it as a Picklist , Take it as a Text and in the Workflow Formula use CASE(expression, value1, result1, value2, result2,...,else_result) . It should provide you with your answer. It should be somewhat like .. CASE(MONTH(Date__c ), 1, 'January', 2, 'February',3,'March',4, 'April',5, 'May',6, 'June',7, 'July',8, 'August',9, 'September')
Hit Kudos if this is or previous message was useful to you . If you find this as a solution to you question then mark it as a solution .
Thank You
yeah, done
Thank you Guatham :)
Kudos :)