Explore AX.com

Skip to content
  • Home
  • About Me
  • Questions?
  • X++ 101

Approve By Email

Approve your AX 2009 and 2012 Workflows direct from your inbox with Axnosis Email Approver. Works with Outlook, Blackberry, Android, iPad, iPhone etc...

Recent Posts

  • Saving Company Logo to file (X++)
  • Prevent AX Reports from Auto-Sending via Outlook Email
  • Allow non editable table fields to be modified via AIF.
  • Batch Job Updates – The Corresponding AOS Validation Failed
  • AX User 101 – Tips and Tricks for Using AX

Categories

  • AIF
  • AX2012
  • Client
  • Dynamics AX
  • Environment Management
  • Further Reading
  • Integration
  • Jobs
  • Model Management
  • Quick Tips
  • Role Centers
  • Security
  • SQL Scripts
  • SSRS
  • Training
  • Uncategorized
  • Workflow
  • X++

Archives

  • May 2018
  • February 2018
  • January 2018
  • January 2016
  • October 2015
  • September 2015
  • August 2015
  • July 2015
  • June 2015
  • May 2015
  • April 2015
  • March 2015
  • February 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

About

Welcome to my blog, a place where I record my thoughts and discoveries as I explore the Dynamics AX landscape.

Subscribe to ExploreAX.com

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Online XPO Reader (Beta)

Online XPO Reader

Explore AX.com

Don’t only practice your art, but force your way into its secrets

Skip to content
  • Home
  • About Me
  • Questions?
  • X++ 101

Approve By Email

Approve your AX 2009 and 2012 Workflows direct from your inbox with Axnosis Email Approver. Works with Outlook, Blackberry, Android, iPad, iPhone etc...

Recent Posts

  • Saving Company Logo to file (X++)
  • Prevent AX Reports from Auto-Sending via Outlook Email
  • Allow non editable table fields to be modified via AIF.
  • Batch Job Updates – The Corresponding AOS Validation Failed
  • AX User 101 – Tips and Tricks for Using AX

Categories

  • AIF
  • AX2012
  • Client
  • Dynamics AX
  • Environment Management
  • Further Reading
  • Integration
  • Jobs
  • Model Management
  • Quick Tips
  • Role Centers
  • Security
  • SQL Scripts
  • SSRS
  • Training
  • Uncategorized
  • Workflow
  • X++

Archives

  • May 2018
  • February 2018
  • January 2018
  • January 2016
  • October 2015
  • September 2015
  • August 2015
  • July 2015
  • June 2015
  • May 2015
  • April 2015
  • March 2015
  • February 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

About

Welcome to my blog, a place where I record my thoughts and discoveries as I explore the Dynamics AX landscape.

Subscribe to ExploreAX.com

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Online XPO Reader (Beta)

Online XPO Reader

User Options

1 Comment Posted on August 4, 2014 AX2012, Client, Dynamics AX, Quick Tips, Uncategorized, X++

Setting Status Bar options in Code and SQL

Problem / Symptom: How to automatically set the status bar options (Under User Options) for all users.

Description: As a developer or functional consultant we quite often receive support requests from users with very little information as to their circumstances under which the issue occurs. E.G. What environment where they working on (Prod, QA, Dev)? What is their userId etc (in order to find out security settings applied)? What currency? and most importantly what AX company they are logged into. All of this information can be set to be displayed in the users status bar by setting enabling it per user under Administration -> Users -> Options -> Status Bar.

Screen Shot 2014-08-04 at 4.29.50 PM

 

It really helps to have it set over there so that screenshots will normally just show this information.

However you may want to set these options globally for all users when initially configuring the system. Doing this manually is quite a tedious process and there is no field per setting to do it in a quick sql script or AX job. Rather AX stores it in a single binary field called “Userinfo.StatusLineInfo” and uses bitwise operators for setting and reading the individual options. This really makes it a bit tricky to set but is very efficient in terms of space and reading speed for the system.

So how do you perform this global setting? My first two options will show you how to set all users to have the same option sets, my last solution will show you how to set only one specific setting for all users.

OPTION 1 (AX Solution): 
1. Login with your AX user and navigate to Administration -> Users -> Options -> Status Bar.
2. Set all the status bar parameters that you would like to display for all users.
3. Create a new Job in the AOT with the following code:

1
2
3
4
5
6
7
static void syncAllUserToCurrentUserStatusBarOptions(Args _args)
{
    UserInfo user, updUser;
    select user where user.id == curUserId();
    
    update_recordSet updUser setting StatusLineInfo = user.StatusLineInfo;
}

OPTION 2 (SQL Solution):
1. Login with your AX user and navigate to Administration -> Users -> Options -> Status Bar.
2. Set all the status bar parameters that you would like to display for all users.
3. Login to your SQL database for AX, locate your user record in the UserInfo table
4. Copy the StatusLineInfo value field value.
5. Execute the following script

1
update userinfo set statuslineinfo=[COPIED VALUE]

e.g.

1
update userinfo set statuslineinfo=-529533

This example will set all users to have the following options: Show help text, Show Utility layer, Show Company accounts, Show currency, Show UserId, Show Alert Status, Show AOS name, Show Current Model, Show Document Attachments button, Show Record Navigation buttons, Show View Edit Record Button, Show details form details/grid view buttons.

Option 3 Set a specific option for all users:
1. Open the AOT, expand forms node, navigate to SysUserSetup Form.
2. Right click, click “View Code”
3. Open the “ClassDeclaration” method.
4. Move down to approx line 57 where there are a whole bunch of macros entitled #LOCALMACRO.FLAG_XXXXXXXX
5. Locate the macro that has the setting that you want to use e.g. #LOCALMACRO.FLAG_StatuslineShowPartition to show the default partition. Take note of the value after the “<<” symbol. E.g. 19

6. Create a new job with the following code:

1
2
3
4
5
6
7
8
9
10
11
static void addStatusBarOptionToAllUsers(Args _args)
{
    UserInfo updUser;
ttsBegin;
while select forUpdate updUser
{
updUser.statuslineInfo = updUser.statuslineInfo | (1 &lt;&lt; [value from step 6]);
updUser.doUpdate();
}
ttsCommit;
}

E.G. To set all users to show default partitions:

1
2
3
4
5
6
7
8
9
10
11
static void addStatusBarOptionToAllUsers(Args _args)
{
    UserInfo updUser;
ttsBegin;
while select forUpdate updUser
{
updUser.statuslineInfo = updUser.statuslineInfo | (1 &lt;&lt; 19);
updUser.doUpdate();
}
ttsCommit;
}

7. Execute the job

NOTE: To remove a setting from all users simply replace the line

1
updUser.statuslineInfo = updUser.statuslineInfo | (1 &lt;&lt; 19);

with

1
updUser.statuslineInfo = updUser.statuslineInfo ^ (1 &lt;&lt; 19);

Simple as that (sortof)

Hope you benefit from this. Drop me any comments if anything is unclear.

Bitwise operators Status bar User Options User Settings UserInfo
Proudly powered by WordPress | Theme: Adaption by Automattic.