You need to sign in to do that
Don't have an account?
Petercass88
First of month Validation Rule
I have a validation rule that requires the close date to be the first of the month. So far i have tested the formula to work on every month but December. I cant figure out where the logic is becoming broken for that month. Any help?
DAY(CloseDate) <>
IF(Month(CloseDate)=12, 31,
DAY(DATE(YEAR(CloseDate),MONTH(CloseDate),1)))
Thanks!
right its very simple...just see the Day of Close Date is 1 or not.
and raise an error message.
All Answers
Please provide some more examples. What is the exact requirement.?
If you require that while creating Oppty record Close Data should be the start Day of month's. Am i correct? then you need to just check the Day should be one nothing else.
whether creating or updating the close date i would like it to only display the first of the selected month:
1/1/11
2/1/11
3/1/11
4/1/11
5/1/11
6/1/11
7/1/11
8/1/11
9/1/11
10/1/11
11/1/11
12/1/11
maybe i over-complicated my formula. Are you suggesting it should be:
DAY(CloseDate) <> Day(1)
right its very simple...just see the Day of Close Date is 1 or not.
and raise an error message.
Thanks! I have a nasty habbit of over-complicating things sometimes.
If you not require to throw an error you can handle it through Opportunity triiger.
trigger on Opportunity(before update, before insert)
{
for(Opportunity opp: Trigger.New)
{
if(opp.CloseDate!=null)
{
Date clsDate=opp.CloseDate;
integer day=1;
integer month=clsDate.Month();
intger Year=clsDate.Year();
Date actualDate= date.newInstance(Year,month,day);
opp.CloseDate=actualDate;
}
}
}
Its very simple.
you lost me on this, where do i insert a trigger and what exactly does this function do? I am not proficient at coding