Home > X++ stuffs > Configuration Key Status Using X++ Code

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();

    configKeySet.loadSystemSetup();

 

    for (i=1; i <= configKeySet.cnt(); i++)

    {

        dictConfigKey = new DictConfigurationKey(configKeySet.cnt2Id(i));

        strOutput     = dictConfigKey.enabled() ? "enabled:" : "disabled:";

        strOutput    += " " + " " + dictConfigKey.name();

        mapConfigKey.insert(i, stroutput);

    }

 

    _args = new Args(formstr(SysPick));

    _args.parmObject(mapConfigKey);

 

    formRun = classfactory.formRunClass(_args);

    formRun.init();

    formRun.run();

 

    formRun.setCaption(‘ConfigurationKey Status’);

    formRun.wait();

}

20851015.jpg

On executing this job, the output will be displayed in a SysPick form

Advertisements
Categories: X++ stuffs
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: