Skip to Content
0
Former Member
Dec 01, 2008 at 08:51 PM

Execute Saved Query in Business One

484 Views

Hi,

We have the following functionality in one of our addons :

User can associate saved queries in B1 with any window in B1 and execute via a right click menu.

this is how we have written code to do this:

1. user clicks menu to exeute query from any window (e.g. BP window)

2. addon "programatically" scans the menu name under Tools >> Queries >> User Queries >> User defined Categories till it gets to the menu name specified

3. Gets the menu id of the query and fires a menu click event.

As you may know already the menu id's "User Defined Categories" in B1 change dynamically every time a user logs in. Majority of the time the menu id for user categories is a 6-9 digit positive number.

However sometimes one of the user categories is a 10 digit -ve number. In this case the logic that we I have laid out above breaks when it gets to the user category with the -ve menu id. When this happens, the final result is that the query is not executed and the user cannot see the results.

This has been a recent development that I have seen only on 2007 environments. On some machines this never happens and on some it happens very rarely (1 in 25-30 times the user logs on). But recently we came across a machine (one of our test machines where this happens 1 in 3 times when the user logs on).

We have tried to recreate this -ve 10 digit menu id by prorgamtically adding it to the menu structure via the xml file but the menu id does not show up in the SAP menus.

So I m hoping you can help me with 2 things:

1. Ideas on how get a query's menu id differently than the logic I laid out above.

2. This looks like an SAP issue since it doesnt let me add the menus via the UI API. any thoughts on that?

I really appreciate if anyone can help me out with this.

Thanks,

Gopal