Показать сообщение отдельно
Старый 11.06.2022, 20:15   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
How to write to an event log from inside of a transaction
Источник: http://alexvoy.blogspot.com/2022/06/...om-inside.html
==============



// to write your log from inside of another transaction
static public void insertExtEventLogInSeparateConnection(RefRecId _lineRecId, str _guid, str _logSource, str _logStr)
{
ExtEventLog log;
UserConnection connection;
int ttsLevel = appl.ttsLevel(); //here you can check if you are inside of a transaction
str errMsg = strFmt("Cannot add event log '%1:%2:%3'", _guid, _logSource, _logStr);
// let's create a separate connection
try
{
connection = new UserConnection();
connection.ttsbegin();
log.setConnection(connection);
log.InstructionDocLineRecId = _lineRecId;
log.TaskGUID = _guid;
log.LogStr = _logStr;
log.LogSource = _logSource;

log.doInsert();
connection.ttscommit();
}
catch
{
throw error(errMsg);
}
finally
{
if(connection)
{
connection.finalize();
}
}
}





Источник: http://alexvoy.blogspot.com/2022/06/...om-inside.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.