Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Easiest way to set configuration key and value and retrieve with x++ in form extension

(0) ShareShare
ReportReport
Posted on by 15

Dear forum,

I am just starting with Dynamics 365 F+O and after setting a dev environment and creating an extension, I would like to find a way to 
set and retrieve configuration values, so that later my module can differentiate its functionality per environment.

How is that accomplished in Dynamics 365 F+O form extension?

I would really appreciate any help!

  • Martin Dráb Profile Picture
    232,046 Most Valuable Professional on at
    RE: Easiest way to set configuration key and value and retrieve with x++ in form extension

    Your API setup doesn't belong to the form with dimension values. Create your own table and either put it into an existing parametr form (if suitable), or create a new one. But you'll likely want to familiarize yourself with F&O form patterns, table design and so on, before you start designing your solution.

  • Athankon Profile Picture
    15 on at
    RE: Easiest way to set configuration key and value and retrieve with x++ in form extension

    Thanks again for all the details and valuable hints,

    The form I am extending has a different setup and there are no parameters, will check it out soon and will come back to you.

  • Martin Dráb Profile Picture
    232,046 Most Valuable Professional on at
    RE: Easiest way to set configuration key and value and retrieve with x++ in form extension

    Please at my first reply to get some idea about parameters are handled in F&O. No, there is no generic table that you should use. Design what you need for your purpose, give it a name and set permissions to this table/form. If there was a single generic table, you couldn't configure security in the right way, refer to values in a strongly-typed manner in code and so on.

    You should respect the system you're working with and follow patterns that people are used to use there.

    Not exposing your parameters to users is easy - simply don't give permissions to anyone (except of users in the security role that will maintain this setup).

  • Athankon Profile Picture
    15 on at
    RE: Easiest way to set configuration key and value and retrieve with x++ in form extension

    Thanks, Martin,

    So my guess is that I must store the values manually in the database for each environment. But I do not wish these values to be exposed to the users. Would there already be a generic table for that and an easy way to reference in code with X++?

  • Martin Dráb Profile Picture
    232,046 Most Valuable Professional on at
    RE: Easiest way to set configuration key and value and retrieve with x++ in form extension

    You seem to be giving us a different little piece of every time, but without the whole picture, it's difficult to say what you actually need. You should rather start by explaining the overall requirement.

    But in short, F&O uses the database, not configuration files, to store configuration. Then you put different data to different F&O environment (each environment has its own database).

  • Athankon Profile Picture
    15 on at
    RE: Easiest way to set configuration key and value and retrieve with x++ in form extension

    Hi Martin, thanks again for the updates.

    My question was more towards having a configuration key value pair that I can set and reference in the code of my form extension.

    More specific, I have a class that extends the form I need - [ExtensionOf(formStr(DimensionValueDetails))] - with some event handlers that are executed when CRUD events occur, calling an API.

    For each environment, I want to target a different API:

    FinOps Dev --> API DEV

    FinOps Test --> API Test etc.

    In other applications I would have an app.settings.{environment}.json or a web.{environment}.config

    How can I set and retrieve these kinds of values?

  • Suggested answer
    Martin Dráb Profile Picture
    232,046 Most Valuable Professional on at
    RE: Easiest way to set configuration key and value and retrieve with x++ in form extension

    That's a completely different question.

    Where you can define dimension values depends on the type of dimension.

    For custom dimensions, you can go and add a value (if you have permissions).

    For entity-backed dimensions, you simply create a record through the appropriate form. For example, if you use a project as a dimension, you'll go to project management and create a new project.

  • Athankon Profile Picture
    15 on at
    RE: Easiest way to set configuration key and value and retrieve with x++ in form extension

    Hi Martin,

    Thanks for taking the time to reply to me.

    I navigated to Setup > Warehouse management parameters > and I could see all sections pointing to the table "WHSParameters" you mentioned, but how do I add my custom name value pair in that table?

    My required configuration is for: General ledger > Financial Dimensions > {Active dimension} >Dimension Values

    What could I use in that case?

    Thanks in advance for any help.

  • Suggested answer
    Martin Dráb Profile Picture
    232,046 Most Valuable Professional on at
    RE: Easiest way to set configuration key and value and retrieve with x++ in form extension

    Data is stored in tables. The basics parameters of each module is in its "Parameters" table, plus there is usually a bunch of tables with other setup.

    For example, if you open Warehouse management module, you'll find these basic parameters under Setup > Warehouse management parameters. The table is called WHSParameters and when you need a values of a parameter, you'll call find() method and read the field. For example:

    WHSParameters::find().EnableVendFilters

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,280 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,046 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans