AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 27.04.2012, 16:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
ax-erp: Code that must not be put in data source active() method
Источник: http://microsoft-dynamics-ax-erp.blo...t-in-data.html
==============

Recently I got this error when trying to update spec quantity in salesEditLines form.

Cannot edit a record in Sales order - Update table (SalesParmTable).
The values displayed in the form are not current, so an update or deletion cannot be made. To view the current values, on the Command menu, click Restore or press CTRL+F5.

Call stack shows nothing but suddenly system goes to the write() method of the SalesParmTable. It is strange that I didn't change any field but it fires SalesParmTable.write() data source method.

Comparing the modification, I found that my fellow developer put a field assignment code within the SalesParmTable.active() method, so the code will always be run repeatedly (not sure how many time per minute, but it is very often). Since system get message that a field has been changed, write method is fired although the stack trace does not show any indication why write() method is fired. Again, it is hard since debugger doesn't tell what previous event causing this write() method.

So then I remove the field assignment code from the datasource active() method and the problem is gone.
The lesson from this is that we must never put an field assignment code within datasource active() method. It should only contains code for changing field behavior such as alowedit, enabled, visible, etc.



Источник: http://microsoft-dynamics-ax-erp.blo...t-in-data.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
Старый 27.04.2012, 18:40   #2  
S.Kuskov is offline
S.Kuskov
Участник
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
 
3,429 / 1772 (66) ++++++++
Регистрация: 28.04.2007
Адрес: Калуга
Что такое "field assignment code"?
Старый 27.04.2012, 18:44   #3  
oip is offline
oip
Axapta
Лучший по профессии 2014
 
2,564 / 1416 (53) ++++++++
Регистрация: 28.11.2005
Записей в блоге: 1
Код, устанавливающий значение полю. Где-то у него там в active поле в коде менялось, срабатывал write и все становилось плохо.
__________________
С уважением,
Олег.
За это сообщение автора поблагодарили: S.Kuskov (1).
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: Writing Data Upgrade Scripts Part 1: Understanding the components of the process Blog bot DAX Blogs 0 10.02.2012 05:16
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11
gatesasbait: Dynamics AX 2009 SSRS and SSAS Integration Tips Blog bot DAX Blogs 3 09.07.2009 13:07
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 23:47.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.