Показать сообщение отдельно
Старый 11.02.2018, 02:41   #1  
Blog bot is offline
Blog bot
Участник
 
20,808 / 715 (65) +++++++
Регистрация: 28.10.2006
doens.be: Ax2009 Event Processing Error
Источник: https://www.doens.be/2012/02/ax2009-...cessing-error/
==============

I have a customer that gets a error every time the EventJobCUD-batch (Change Based Events) runs. They got the following error:


After some reseach I found out that when 2 fields are changed at the same time, you go several times through the listChangedFieldsEnumerator (location ClassesEventProcessorCUDprocessUpdate)

while (listChangedFieldsEnumerator.moveNext()){ // In this simple case we use the new and the original changed field value as // recorded at event detection time: [thisFieldId, changedFieldValue, origChangedFieldValue] = listChangedFieldsEnumerator.current(); if (rule.AlertFieldId == thisFieldId) break;}The code underneed simulates the same situation in a small job:

static void Job5(Args _args){ anytype any; ; any = ABC::A; // next line will throw a error any = BatchStatus::Canceled;}And here we get the basic same error “Error executing code: Wrong argument types in variable assignment.”

I modified the code so the anytype is assigned only when the field is correct:

while (listChangedFieldsEnumerator.moveNext()){ // In this simple case we use the new and the original changed field value as // recorded at event detection time: thisFieldId = conpeek(listChangedFieldsEnumerator.current(), 1); if (rule.AlertFieldId == thisFieldId) { [thisFieldId, changedFieldValue, origChangedFieldValue] = listChangedFieldsEnumerator.current(); break; }}

Источник: https://www.doens.be/2012/02/ax2009-...cessing-error/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.