Configuration Key Status Using X++ Code

As we are aware, Configuration key controls access to specific feature. To know about the status of a configuration key, the user has to traverse Administration->Setup->System-> Configuration.
Instead with the following job, a user can know the status of all the configuration keys that is being used in the system.

//Configuration key names and their enable state.
static void ConfigurationKey(Args _args)
    ConfigurationKeySet   configKeySet;
    DictConfigurationKey  dictConfigKey;
    Object                         formRun ;
    Map                             mapConfigKey;
    str                                strOutput;
    int                                i;

    mapConfigKey = new Map(Types::Integer, Types::String);
    configKeySet = new ConfigurationKeySet();

    for (i=1; i <= configKeySet.cnt(); i++)
        dictConfigKey = new DictConfigurationKey(configKeySet.cnt2Id(i));
        strOutput     = dictConfigKey.enabled() ? "enabled:" : "disabled:";
        strOutput    += " " + " " +;
        mapConfigKey.insert(i, stroutput);

    _args = new Args(formstr(SysPick));

    formRun = classfactory.formRunClass(_args);

    formRun.setCaption('ConfigurationKey Status');
On executing this job, the output will be displayed in a SysPick form

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.