Use Case
Question 1
I am trying to create a formula field (Semester__c) that reads off of the Created Date and returns a Text value where:
IF Created Date is between August 1 and December 31 of any year = "FALL"
IF Created Date is between January 1 and June 1 of any year = "SPRING"
I am also trying to create a formula field (Year__c) that reads off of the Created Date's Year and also returns a text value where:
IF Created Date year is 2015 = "2015"
How would I go about doing this? I'm hitting a wall when it comes to figuring out how to break down a date into components.
Question 2
Using the above formula field (Semester__c), I would like to create a workflow that names these records in a uniform manner, ideally something like this:
"Semester__c" & " " & "Year__c" & " - " & "Status__c"
If all three fields are on the same object (Enrollment History), is this possible?
4 respuestas
This guide will give you sample formulas which you can use to return the quarter & year from a date value.
https://help.salesforce.com/HTViewHelpDoc?id=formula_examples_dates.htm&language=en_US#.which-quarter
Unfortunately values from formula fields can't be referenced for field updates.
https://help.salesforce.com/HTViewHelpDoc?id=workflow_field_update_considerations.htm&language=en_USBut you could create a workflow rule & field update which uses the above formulas & the formula which you've posted already, to set the name of a record. When you create the record, call it whatever you want, the value will be overwritten as long as you set the workflow to something generic like
DATEVALUE(CreatedDate) = TODAY()
So the final formula for the field update is
CASE( CEILING( MONTH ( DATEVALUE(CreatedDate )) / 3 ),
1, "SPRING",
2, "SPRING",
3, "FALL",
4, "FALL",
NULL)
& " " &
IF(YEAR(DATEVALUE(CreatedDate)) = 2015, "2015", NULL)
& " - "
But you won't be able to include the value from Status__c, if this is a formula field.