Automatic Change of Allow Posting Date

Hi EveryBody,

I want to write a closed procedure and automatically open the date in the following manner :

  1. When the end of the month (ex : End Month 31/05/2018 at 01/06/2018 00h:00) then Allow Posting From : 01/05/2018 and Allow Posting To : 30/06/2018

2**.** When the third working day of the month comes (exclude the Sunday of the month, The third working day of June is: 04/06/2018),

the Posting Date will automatically set Allow Posting From : 01/06/2018 and Allow Posting To : 30/06/2018

Please help me solution. Thanks so much.

Best Regards,

Dinh Son

You can write a Codeunit and configure it as a recurrent task in Job Queue Entry. In the task, you have to check every day of the week, excluded sunday (or not, is it not important). You have to code the conditions to change allowed dates in codedunit.

First condition:

TODAY = CALCDATE('<-CM>', TODAY) --> this means, first day of month
DATE2DMY(TODAY,1) = 1 --> first day of month, too

Second condition:

((DATE2DMY(TODAY,1) = 4) AND (DATE2DWY(TODAY,1) <= 3))

Thanks you Llaneras.