V
V
ViktorGuerro2022-03-04 08:38:53
1C
ViktorGuerro, 2022-03-04 08:38:53

Why doesn't the directory write in the background job?

Atypical configuration, in scheduled tasks (background tasks) there is mail processing, here are the properties: https://disk.yandex.ru/i/KXnVjuNxK1kD9w the method name says: "Module of Scheduled Tasks. Mail Processing"
There is a common module here are the properties: https://disk .yandex.ru/i/4S-tYmytBkx5_g
When running a background task, an error occurs:

Mistake
В данной транзакции уже происходили ошибки!
{ОбщийМодуль.МодульРегламентныхЗаданий.Модуль(1110)}:СправочникПисьма.Записать();

по причине:
В данной транзакции уже происходили ошибки!


The code
УстановитьПривилегированныйРежим(Истина);
НачатьТранзакцию();
...

Для каждого Сообщение Из МассивСообщений Цикл

...

СправочникПисьма = Справочники.Письма.СоздатьЭлемент();
СправочникПисьма.УстановитьНовыйКод();
СправочникПисьма.Наименование = Сообщение.ИдентификаторСообщения;
СправочникПисьма.ДатаПисьма = Сообщение.ДатаОтправления;
СправочникПисьма.Записать();

КонецЦикла;

ЗафиксироватьТранзакцию();
УстановитьПривилегированныйРежим(Ложь);


How to solve the problem? Under the normal user everything fulfills without errors.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Prokhorovich, 2022-03-04
@alexgp13

Errors have already occurred in this transaction!

This means that you have a double attempt, an internal attempt falls into an exception, 1C cannot handle such a situation. Go with the debugger or look for the nested Try-Exception and remove it, then the main Try-Exception will catch the error and display it.

K
Konstantin, 2022-03-04
@fosihas

1. there is a debugger
2. probably with the code what the hell

V
ViktorGuerro, 2022-03-07
@ViktorGuerro

I solved the problem, but did not notice how I changed it:
1) I created a user in 1C and in the USR1CV8 user directory, gave him admin rights and made authorization through the OS through the USR1CV8 account;
2) Disabled transactions as asked in this question;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question