K
K
Kairr2021-09-06 11:25:03
1C-Bitrix
Kairr, 2021-09-06 11:25:03

How to insert in the "deadline" field (in the BP in adding a task) the last business day of the current month?

I am doing a business process in which I need to add a task with a deadline of the last business day of the current month.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
ReaverJS, 2021-09-06
@Kairr

Number of days in the month
=date('t', {=System:Date})
Current month and year
=date('d.y', {=System:Date})
Last day of the month (glued together from previous lines) [lastDay]

=date('t', {=System:Date}) & '.' & date('d.y', {=System:Date})

Checking for working hours
=if( isWorkDay({=Variable:lastDay}),  'Да',  'Нет')

If the day is working - leave it as it is, if not - minus one working day
=if(  isWorkDay({=Variable:lastDay}),  {=Variable:lastDay},  addworkdays({=Variable:lastDay}, -1)  )

Total:
Блок 1: Установка переменной lastDay
{=date('t', {=System:Date}) & '.' & date('d.y', {=System:Date}) }

Блок 2: Установка времени в задаче
{=if(  isWorkDay({=Variable:lastDay}),  {=Variable:lastDay},  addworkdays({=Variable:lastDay}, -1)  )}

It is possible without a variable, but here such a tin will be

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question