mandag den 2. januar 2017

Quickly setting up what the status bar will show for your user.

When documenting test or setup it is advantageous to show as many values in the status bar as possible (especially the AOS name and company accounts id and maybe date and time), to be able to show in screen dumps what environment you are using.

Here is a quick little job for setting up ALL fields to be shown in the status bar.

Dynamics AX 2009:

static void Job130(Args _args)
{
    #LOCALMACRO.FLAG_StatusLineHelpText             (1 << 0) #ENDMACRO
    #LOCALMACRO.FLAG_StatuslineDatabase             (1 << 1) #ENDMACRO
    #LOCALMACRO.FLAG_StatuslineWatch                (1 << 2) #ENDMACRO
    #LOCALMACRO.FLAG_StatuslineNumLock              (1 << 3) #ENDMACRO
    #LOCALMACRO.FLAG_StatuslineCapsLock             (1 << 4) #ENDMACRO
    #LOCALMACRO.FLAG_StatuslineActivity             (1 << 5) #ENDMACRO
    #LOCALMACRO.FLAG_StatuslineSystemDate           (1 << 6) #ENDMACRO
    #LOCALMACRO.FLAG_StatusLineShowUtilLayer        (1 << 7) #ENDMACRO
    #LOCALMACRO.FLAG_StatusLineShowCurrency         (1 << 8) #ENDMACRO
    #LOCALMACRO.FLAG_StatusLineShowUser             (1 << 9) #ENDMACRO
    #LOCALMACRO.FLAG_StatusLineShowCustom           (1 << 10) #ENDMACRO
    #LOCALMACRO.FLAG_StatusLineShowAlertStatus      (1 << 11) #ENDMACRO
    #LOCALMACRO.FLAG_StatusLine_unknown             (1 << 12) #ENDMACRO
    #LOCALMACRO.FLAG_StatusLineAOSName              (1 << 13) #ENDMACRO

    UserInfo        u;

    ttsbegin;
    select firstonly forupdate u
        where u.id == curuserid();
    u.statuslineInfo = u.statuslineInfo | #FLAG_StatusLineHelptext; // Bit 0
    u.statuslineInfo = u.statuslineInfo | #FLAG_StatuslineDatabase; // Bit 1
    u.statuslineInfo = u.statuslineInfo | #FLAG_StatuslineWatch; // Bit 2
    u.statuslineInfo = u.statuslineInfo | #FLAG_StatuslineNumLock; // Bit 3
    u.statuslineInfo = u.statuslineInfo | #FLAG_StatuslineCapsLock; // Bit 4
    u.statuslineInfo = u.statuslineInfo | #FLAG_StatuslineActivity; // Bit 5
    u.statuslineInfo = u.statuslineInfo | #FLAG_StatuslineSystemDate; // Bit 6
    u.statuslineInfo = u.statuslineInfo | #FLAG_StatusLineShowUtilLayer; // Bit 7
    u.statuslineInfo = u.statuslineInfo | #FLAG_StatusLineShowCurrency; // Bit 8
    u.statuslineInfo = u.statuslineInfo | #FLAG_StatusLineShowUser; // Bit 9
    u.statuslineInfo = u.statuslineInfo | #FLAG_StatusLineShowCustom; // Bit 10
    u.statuslineInfo = u.statuslineInfo | #FLAG_StatusLineShowAlertStatus; // Bit 11
    u.statuslineInfo = u.statuslineInfo | #FLAG_StatusLine_unknown; // Bit 12
    u.statuslineInfo = u.statuslineInfo | #FLAG_StatusLineAOSName; // Bit 13
    u.doupdate();
    ttscommit;
}

Dynamics AX 2012 version will follow.