W
W
wkst2021-07-21 14:26:21
Bitrix24
wkst, 2021-07-21 14:26:21

Bitrix24 box. When adding a user $USER->Add I get an error 500, what's wrong?

The user is created when adding the "Personnel changes" IB element using the AddEventHandler("iblock", "OnBeforeIBlockElementAdd", "OnBeforeIBlockElementAddHandler"); In the handler, the user's data is formed into an array and added using $USER->Add, but if I add the "UF_DEPARTMENT" field to the user, which is "Binding to sections of info blocks" - the info block of the department, Bitrix simply returns an error 500. Where to dig?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Nikolaev, 2021-07-21
@gromdron

Пользователь создается при добавлении элемента ИБ "Кадровые изменения"

You should not use this mechanic, because... drumroll!... Adding an employee to the portal creates an entry in the "Personnel changes" IB. This way you get an infinite loop: a record creates a user that creates a record that creates a user...
Give up your mechanics in favor of simply adding a user, or if you really don’t want to at all, then put a restriction on the recursion ( for example, like this )

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question