You need to sign in to do that
Don't have an account?
Alexandra Stehman
Using Case statements within IF clause in a formula
I want to do something pretty basic, which is, add number of business days to a date based on the record type ID. I made a formula like below. However, the compiler reports "Error: Syntax error. Extra CASE"
The only other way I can think of to do this would be a horrible series of if statements which check for the record type id and then each variation of the date mod. I have about 5 other if clauses to add to this, just did not put everything in for the sake of clarity.
(I'm still new at this - could write this in Java/Grails - am tempted to turn the whole thing into a class?)
The only other way I can think of to do this would be a horrible series of if statements which check for the record type id and then each variation of the date mod. I have about 5 other if clauses to add to this, just did not put everything in for the sake of clarity.
(I'm still new at this - could write this in Java/Grails - am tempted to turn the whole thing into a class?)
if (RecordTypeId == '012o00000003jkn') CASE( MOD( CreatedDate - DATE( 1900, 1, 7 ), 7 ), 3, CreatedDate + 2 + 140, 4, CreatedDate + 2 + 140, 5, CreatedDate + 2 + 140, 6, CreatedDate + 1 + 140, CreatedDate + 140 ) if (RecordTypeId = '012o00000003jks') CASE( MOD( CreatedDate - DATE( 1900, 1, 7 ), 7 ), 3, CreatedDate + 2 + 10, 4, CreatedDate + 2 + 10, 5, CreatedDate + 2 + 10, 6, CreatedDate + 1 + 10, CreatedDate + 10 ) CreatedDate
Best Answer chosen by Alexandra Stehman
Karanraj
Hi Alexandra - Try the below one