Other recent Dynamics AX Blog postings

Montag, Juni 04, 2007

Be careful when resetting your usage data

First of all, my apologies for not having written anything in the last weeks. But I'm really busy with my project at the moment....

But here's another thing for you:
in Dynamics AX 4.0, a "Favorites" menu was introduced. You can drag a form to your favorites pane. Then you will be asked to give it a name, and: you can add a saved query to it. With that, you can easily make favorites the open the forms filtered on the data you just need.

But there's another thing: as long as your system is still in change, everybody recommends that you delete your usage data from time to time (in User/Options).

But what happens to your favorites if you delete all your usage data?
The answer is: you'll get an error message. The system will tell you that it cannot find your saved query anymore. So, the whole work saving your queries and making your favorites is lost.

A small little addition to the method "reset" in the form "SysLastValue" will help you avoid that.

Add the line

&& _sysLastValue.recordType != UtilElementType::UserSetupQuery;

in the "delete_from" statement.

So, the deletion will not delete your saved queries.
Things that could be improved:
  • Only skip queries that have been saved with a name
  • Only skip queries that are used for a favorite menu item

2 Kommentare:

karabela hat gesagt…

does this also work on axapta 3.7 sp4.

i tried this and got syntaxis errors.

void reset()
{
DialogButton button = box::yesNoCancel("@SYS62458", DialogButton::No, "@SYS70748");
SysLastValue _sysLastValue;

if (button == DialogButton::Yes)
{
ttsbegin;
delete_from _sysLastValue
&& _sysLastValue.recordType != UtilElementType::UserSetupQuery; where _sysLastValue.userId == userId;
ttscommit;
}
}

Diego Mancassola hat gesagt…

Nice post. It's also possible to insert (AX2009) a link to a report with user custom query to favourites menu? I able to insert a link to form but when i insert a link to report the combobox of custom query is disabiled... Tnks