This week's post details a pair of useful X++ Jobs used to manage Usage Data. Usage data is stored in the table SysLastValue, and is a system table that cannot be opened in the AOT Table Browser, however we can still interact with it via X++ jobs. A variety of user specific things are stored in SysLastValue, including personalization, saved filters, form last values, and form last size/position.
As with all X++ Jobs this code has the potential to cause difficult to repair damage to your AX data, use with understanding and caution.
The first job will selectively clear Usage Data for a single object, useful for when you are rolling out customization's to forms. The second job will clear all non-personalization related Usage Data for a single user, which is useful for resolving a variety of issues.
Selectively Clearing Usage Data(SysLastValue)
Whenever you customize a form in AX to add additional elements you need to instruct your users to reset their Usage Data for that form. This is because if a user has personalized a form, the new additions to that form will not be shown to that user.
I have found that even when detailed instructions are sent out, many users will not clear their Usage Data. The result of this is that they will not see the new additions to the form and not be able to take advantage of them.
This simple X++ job will allow you to mass clear specific Usage Data for all users. The SysLastValue table stores usage data. By selectively deleting records from it was can clear specific usage data from a large number of users.
static void clearSysLastValue(Args _args){SysLastValue sysLastValue;NoYes update = NoYes::No;int x;while select * from sysLastValuewhere sysLastValue.elementName == 'HCMworkerListPage'{info(sysLastValue.userId);x++;if(update){ttsBegin;sysLastValue.delete();ttsCommit;}}Info(strFmt("Count %1", int2str(x)));}