V
V
Vikiviki22020-10-21 12:03:28
Bitrix24
Vikiviki2, 2020-10-21 12:03:28

How to calculate the age of a contact in Bitrix24?

Update: figured it out, it was in quotation marks.
But now the question is how to display a negative value if the date of birth is greater than the current date? Thank you!

Good afternoon!
Tell me, please, where is the error:
You need to calculate the age in months. in the contact card
1) Created a custom field in the contact card to record age in it (field type integer)
2) Created bp by changing the variable {{=datediff({=System:Date}, {=Document:UF_CRM_5E8DD2AA4FF3B}, '% m')}}, where {=Document:UF_CRM_5E8DD2AA4FF3B} is the custom field date of birth of the child1
3) Created a variable with an integer field type.
4) By changing the document, I write (on behalf of the admin) the value of the variable in the corresponding field in the card
5) BP is triggered when creating and changing a contact card.
6) Nothing happens. The field where the age should be entered is empty ((((

Thank you very much in advance for your answer!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Nikolaev, 2020-10-21
@gromdron

1) Check the quotes around %m. It must be quotation marks, not apostrophes.
2) Check the field code. As far as I know, there is no "{=Document:UF_CRM_5E8DD2AA4FF3B} in the cloud," in the last update there will be "{{Child's date of birth1}}"
3) You made an infinite loop. Changing any field leads to recalculation of the date and change of the age field.
Changing the "age" field is a change and bp fires again. You need to come up with a stopping mechanism. For example, add the technical field "Old date of birth of a child1" and check in the BP that if the value of "Date of birth of a child1" and "Old date of birth of a child1" are not the same, perform calculations. Otherwise, do not make any changes.
4) There is a special block - "report entry" where you can make the appropriate entries and understand how it displays the necessary information and what it really counts.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question