Where to get context to construct a custom field key?

In order to use REST to update my app’s custom field in a Resolver, I believe I need a key like this:


I can find the first part of this from my Resolver’s Request context. And I can hard-code the last part.

But I cannot find the middle part, the environment name, anywhere.

It is not in req.context. Why not?

On the client side (custom UI), view.getContext() is {} (why???)

Where do I find the environment name?

If you’re using the new native Node.js runtime, then you can refer to this solution.

If you’re using the old Forge runtime, then you can look into setting environment variables as an alternative (don’t know if there’s a better way to achieve this).


forge variables set --environment production ENVIRONMENT PRODUCTION
forge variables set --environment staging ENVIRONMENT STAGING
forge variables set --environment development ENVIRONMENT DEVELOPMENT

Thank you @rcsr !

1 Like