web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Where to place environment-related variable values

(0) ShareShare
ReportReport
Posted on by 61

Hello everyone!

I have a question regarding best practices of storing environment-related variable values. I have two environments: Prod and Sandbox, both utilize GeneratedFilePath variable, which stores the path, where the new generated file will be located. This path is different for two environments and I am qurious where is better to place those values is code?

I haven't found different config areas in app.json file, is it possible to make configuration though config files, or do I need to create some code units, check current env and return proper value?

I have the same question (0)
  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,161 Moderator on at

    I think it would be best if you created a setup table for your functionality and stored the filepath in that setup table.

    Then you can get that setup when you need it in the rest of your code and it is not hard coded anywhere in case it changes,

  • Suggested answer
    Jeffrey Bulanadi Profile Picture
    9,106 Super User 2026 Season 1 on at

    Hi Johny Be Good 

     

    I will agree to Inge, to use a setup tables as a storage of your variables e.g. setup links, urls, credentials and your requirements.

     

    Even if you install an app from extension marketplace, You will notice that there variable values are placed into their respective table setups.

     

    If you find this useful please give it a like or verify the answer. By this way you can help other members know that the topic has been answered. Have a nice day. Thank you.

     

    Cheers,

  • Verified answer
    YUN ZHU Profile Picture
    98,464 Super User 2026 Season 1 on at

    Hi, you can also get the environment name directly in your method, and then add the condition.

    More details: https://yzhums.com/8271/

    pastedimage1659314880602v1.png

    pastedimage1659314886106v2.png

    Hope this helps as well.

    Thanks.

    ZHU

  • Johny Be Good Profile Picture
    61 on at

    Thanks for all your replies, guys!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,850 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,084 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 959 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans