Sunday 17 November 2013

Usage data and SysLastValue Table

The SysLastValue table is the storage for usage data recorded as users navigate the system, such as report selections, query ranges and form selections. And we can delete Usage data from SysLastValue Table.


SysLastValue is a kernel-level table that does not show up in the AOT data dictionary. We can find SysLastValue table in AOT / System Documentation / Tables .

Figure 1 – SysLastValue Table Location


And we can delete Usage data from SysLastValue Table with these steps-

Figure 2 - Click on Table browser(we can only open system table with "Table browser")

Figure 3 -write query and run 

Usage data - When a user makes selections on reports, forms and queries these values are saved in the SysLastValue table. Usage data is unique for every user. This is helpful because often user will desire to access the same data. This allows for a better user experience. We need to reset it because when new development to the underlying objects in the AOT, AX will not be able to translate the data in the usage data container for an object being used. This can result in an error upfront or a non-critical error that just creates extreme slowness or weirdness. This can be achieved by going to the following locations and performing these actions
Tools > Options > Usage data button > Click "Reset" to reset all Usage data.

Figure 4 - Tools > Options and click

Figure 3 – Click on  “Usage Data” Button 

Figure 4 – Click on “Reset” Button and select “Yes” in Box


2 comments:

  1. Thanks for the informative post. Do you know how to copy one user's usage data to another user through a job using X++?

    ReplyDelete
  2. Here is what I am trying. However when I load the prodSetupReportFinished form it does not show the new parameters.

    static void libSetUserRAFPostParm(Args _args)
    {
    SysLastValue sysLastValue, sysLastValueNew;
    UserId toUser = 'toUser';
    UserId fromUser = 'fromUser';


    //Look for existing usage data and delete it.
    select sysLastValue
    where sysLastValue.userId == toUser
    && sysLastValue.recordType == UtilElementType::Usersetup
    && sysLastValue.elementName == 'ProdSetupReportFinished';
    if(sysLastValue)
    {
    ttsBegin;
    sysLastValue.delete();
    ttsCommit;
    }
    ttsBegin;
    //Look up the user's usage data to copy from
    select sysLastValue
    where sysLastValue.userId == fromUser
    && sysLastValue.recordType == UtilElementType::Usersetup
    && sysLastValue.elementName == 'ProdSetupReportFinished';

    try
    { //Copy the usage data to
    sysLastValueNew.clear();
    sysLastValueNew.data(sysLastValue);
    sysLastValueNew.UserId = toUser;
    sysLastValueNew.RecId = 0;
    sysLastValueNew.insert();
    }
    catch
    {
    info(strfmt("Error %1 %2 %3", sysLastValue.UserId,
    sysLastValue.recordType,
    sysLastValue.elementName));
    }
    ttsCommit;
    }

    ReplyDelete