Options

C/AL to read a value from the Registry

compwizardcompwizard Member Posts: 17
edited 2015-09-04 in NAV Three Tier
Hi Guys,

Hope a quick and easy question, I have tried in vein to find exactly what I'm looking for and this forum is always so helpful. :)

I have an action on a screen, underneath it a button which when clicked I wish to read a known value the registry (this value is populated previously as part of the installation of my addon.)

At the moment I'm hard coding the value, but to avoid having to edit the code during deployment it makes sense to read it in.

So for example in HKLM\software\test is a string URL which has in it 'http://<MYSERVER>:8085/cgi-bin/myfile'

Global = url as text

Today hardcode:

url:=('http://<MYSERVER>:8085/cgi-bin/myfile');

What I'd like to do:

url:=('VALUEREADFROMREGISTRY');

I realise I could use GETURL, but this wouldn't fit the deployment framework I'm tied too.

Any help as always appreciated!

Comments

  • Options
    ara3nara3n Member Posts: 9,255
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    compwizardcompwizard Member Posts: 17
    Hi ara3n,

    I didn't realise I needed to select mscorlib, was just looking for Microsoft.Win32 (which isn't in the list of assemblies) so a little confusing ... However

    As an example to others who may benefit from this:

    Set a Dotnet Global REG of Microsoft.Win32.Registry.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    Set a Text Global of myurl for instance and add:

    myurl:=FORMAT(REG.GetValue('HKEY_LOCAL_MACHINE\SOFTWARE\PATHYOUWANT', 'VALUETOFIND', 'http://REGISTRYENTRYNOTFOUND'));

    Many thanks
Sign In or Register to comment.