I
I
Ivan Eremin2018-11-06 18:27:25
Bitrix24
Ivan Eremin, 2018-11-06 18:27:25

Business process in Bitrix24. Checking conditions on variables - where am I wrong?

In the business process, data is supplied during its execution, which are entered in the variables DATE1 and DATE2,
then in the constructor I set the condition: if less than 4 days, then stop the BP with a message to the user.
=if ({=Variable:TODAY{{=datediff({=Variable:DATE1}, {=System:DATE}, '%d' ) }}} <4, 'true')
If 4 or more, then move on =if ({=Variable:TODAY{{=datediff({=Variable: DATE1
}, {=System:DATE}, '%d' ) }}} >=4 , 'true')
then it doesn’t have anything to do with it according to the correct condition (i.e., according to the "left" branch of business processes).
Your suggestions?
Condition type: variable value; property of the variable TODAY (which is calculated); condition: equal to and then choose options according to https://helpdesk.bitrix24.
5be1b4353c69c909430817.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Eremin, 2018-11-06
@divanus

Decided as follows:
Added a block of actions - calculation of dates.
In it:
1. DATE1 = {=Document:PROPERTY_DATE1}
DATE2 = {=Document:PROPERTY_DATE2}
2. Trimmed the date
DATE1 = {{=substr({=Variable:DATE1},0,10)}}
DATE2 = {{= substr({=Variable:DATE2},0,10)}}
3. Length of time between two dates
TODAY = {{=datediff({=Variable:DATE1},{=System:Date},'%a')} } the variable is named ugly, I agree at the
same time I calculated the number of vacation days
DAYS = {{=datediff({=Variable:DATE2},{=Variable:DATE1},'%a')}} I
chose '%a'
as the format 4. Checked conclusion
5. Condition
6. Approval of the document
7. Setting a task for the HR department

A
Andrey Nikolaev, 2018-11-06
@gromdron

Um ... and what kind of tin with brackets is going on with you?
This not normal
To work correctly, create 2 variables:
1) Number of days (type "Number"), which will store the difference between two numbers
2) Condition (type "Yes / No"), which will store the matching conditions for the number of days
It is better to separate these variables, so as in case of complication of the process, the number of days and the condition can branch.
In the block for changing variables, you can enter the corresponding values
​​To get the difference: For comparison
=if({=Variable:diffDate}<4, 'Y', 'N')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question