function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Julia ZocoloJulia Zocolo 

restrict edit on close date except from certain profiles

Hello Everyone,

I need to create a validation rule to not allow the Close Date be changed : ISCHANGED( CloseDate )
if it is from a previous fiscal year (2016 and earlier) and the stage is in Closed-Won: ISPICKVAL(StageName, 'Closed – Won')

UNLESS it is done by either Profile IDs:
     $User.ProfileId = "00ew0000001R9Bh",
        $User.ProfileId = "00ew0000001R98E"

Any assistance would be appreciated!

Thank you,
Julia
Best Answer chosen by Julia Zocolo
Arvind KumarArvind Kumar
Hi Julia,

I have found a solution for your requirement. It will work for you.
 
AND( 
ISCHANGED(CloseDate), 
CloseDate <= DATE(2016,12,31), 
ISPICKVAL(StageName,'Closed Won'), 
NOT(OR( 
($Profile.Id == '00ew0000001R9Bh'), 
($Profile.Id == '00ew0000001R98E') 
) 
) 
)

Please implement it. If you have any query please contact me.


Thanks,
Arvind Kumar

All Answers

Abhishek M.Abhishek M.
Hi Julia,
Please try the following formula,

AND(
    ISCHANGED(CloseDate),
    PRIORVALUE(YEAR(CloseDate)) < 2016,
    OR(
        NOT($Profile.Id == '00ew0000001R9Bh'), NOT($Profile.Id == '00ew0000001R98E')
    )
)

- Hope this helps
Arvind KumarArvind Kumar
Hi Julia,

Please use it, it will work for you.
 
AND(
    ISCHANGED(CloseDate),
    PRIORVALUE(YEAR(CloseDate)) < 2016,
    ISPICKVAL(StageName,'Closed Won'),
    OR(
        NOT($Profile.Id == '00ew0000001R9Bh'), NOT($Profile.Id == '00ew0000001R98E')
    )
)


Thanks,

Arvind Kumar

Julia ZocoloJulia Zocolo
Hello Abhishek & Arvind,

I received an error:
Error: Incorrect argument type for function 'PRIORVALUE()'. 

AND(
 ISCHANGED(CloseDate),
PRIORVALUE(YEAR(CloseDate)) < 2016,
 ISPICKVAL(StageName,'Closed – Won'),
 OR(
        NOT($Profile.Id == '00ew0000001R9Bh'), NOT($Profile.Id == '00ew0000001R98E')
        )


Is there any way to make the statement so I don't have to keep updating the formula by referencing that the close date is a previous fiscal year?

If the opportunity is closed won, close date 10/31/16 , we dont want anyone going back to that opportunity and change the close date to 12/31/16 unless it is either of those 2 profile IDs.

Thank you for your help.
Julia
 
Arvind KumarArvind Kumar

Hi ,

Please give another user profile Id apart from 2 profile which you have mentioned above.

Then, i will give you better solution for above requirement.

Thanks,

Arvind Kumar

Arvind KumarArvind Kumar
Hi Julia,

I have found a solution for your requirement. It will work for you.
 
AND( 
ISCHANGED(CloseDate), 
CloseDate <= DATE(2016,12,31), 
ISPICKVAL(StageName,'Closed Won'), 
NOT(OR( 
($Profile.Id == '00ew0000001R9Bh'), 
($Profile.Id == '00ew0000001R98E') 
) 
) 
)

Please implement it. If you have any query please contact me.


Thanks,
Arvind Kumar
This was selected as the best answer
Julia ZocoloJulia Zocolo
Arvind,
Thank you SOOO MUCH!

This works perfectly!!

Thank you,
Julia
Arvind KumarArvind Kumar
Hi,

Welcome Julia,

Regards,
Arvind Kumar