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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 21.04.2011, 22:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,531 / 847 (80) +++++++
Регистрация: 28.10.2006
emeadaxsupport: Users don't want to delete their usage data - but you've redeveloped the form - the solution
Источник: http://blogs.msdn.com/b/emeadaxsuppo...-solution.aspx
==============

The issue we're talking about here is this:
  • There is an AX form which users make their own personalisations to, moving some of the fields around, or perhaps adding other fields (via the right click->setup functions).
  • Then I need to redevelop this form a bit - a couple of new fields are added via the AOT.
  • Now when user's try to load the form it might crash - particular if I have changed the controls on a grid. So first I need to install a hotfix to stop the crash, it was fixed in KB2253378 (5.0.1500.3077 onwards) but as always just implement the newest kernel you can get your hands on.
  • Now when users log in, the crash is stopped, but their saved user settings are not applied to the form, it is back as default layout.
The user settings are stored in the SysLastValue container (SYSLASTVALUE.VALUE). You may have looked at the structure of the sysLastValue data via the usage data form (from user options) before, it just looks like a load of numbers, and it's hard to relate them back to the form. Well I found that the data in the container is basically the form control IDs, stored in a structure to match the structure of the form design.

When I make a change to the form's design in the AOT, for example I add a field to a grid, then this can push all of the existing control IDs up by one, a control that was previously 12301, is now 12302. Now because we use these IDs to match to the layout held in SysLastValue - you can understand how a change to the design in the AOT invalidates the SysLastValue data.

So attached is an xpo (scroll to the bottom) which can rebuild SysLastValue data for a form where the control IDs have changed. You set which form you want to rebuild data for, then it instantiates an instance of that form and then for each record in SysLastValue which relates to that form it iterates through and converts the IDs in SysLastVaue if it finds that they are different from the current form design.

Warning! This code will update the usage data in an unrecoverable way so please take great care when using it - test it first and take a copy of the SysLastValue table before updating it for real. It would be pretty awful to try to help users by recovering their usage data for them and end up making it worse, so please be careful.

Few points about using it:
  • Just run the main() - note that the form name to update is hardcoded in here as "purchTable" at the moment and needs to be changed to whichever form you need.
  • This is for AX2009 only at the moment (because I use a task recorder function which might not be available in AX4 as standard).
  • It picks up the container in SysLastValue.Value and then iterates through it checking the ID for each control that it finds (using a function from task recorder which can return form control IDs) and then updating the container back.
  • This accounts for moving of fields or adding new fields within a parent control. This is a key point - there are an infinite number of possible changes that could be made to the structure of a form, this really only caters for fields being added/moved within their parent control (i.e. doesn't account for moving controls from one parent to another).
  • It should be ok with user added fields, unless the ID of a newly added field conflicts with a user added field (it shouldn't - they are +250 IDs higher).
What I expect the process for a developer to be is:
  • They make their form changes as normal and they are tested etc..
  • When they move the form to live environment, either via XPO or layer they need to run this class for that form to update the sysLastValue data.
  • This needs to be done with no one on the system using that form and before anyone opens the new form (as opening it once will damage the user's default sysLastVaue record for that form and my class can't correct it then).

--author: Tariq Bell--editor: Tariq Bell--date: 21/04/2011


Источник: http://blogs.msdn.com/b/emeadaxsuppo...-solution.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: How to delete orphaned data remained from deleted company? Blog bot DAX Blogs 0 09.12.2010 16:11
Microsoft Dynamics CRM Team Blog: Internal storage of SiteMap and Form customization in managed solution packages Blog bot Dynamics CRM: Blogs 0 16.11.2010 01:12
emeadaxsupport: Office Applications don’t show up embedded in the Dynamics AX Document Handling form Blog bot DAX Blogs 0 05.08.2010 15:05
emeadaxsupport: Wrong data shown in the grid, if the table field is an Int 64 and the form control is an IntEdit instead of an int64edit. Blog bot DAX Blogs 3 22.07.2010 18:00
CRM DE LA CREME! Some more useful javascripts for MS CRM Blog bot Dynamics CRM: Blogs 0 04.05.2010 11:05

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

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

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