Difference between revisions of "GetEnv"
From AgileApps Support Wiki
imported>Aeric |
imported>Aeric |
||
(4 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
;Description:Gets the environment variable value for the <tt>key</tt> <noinclude>via the [[Java API]]</noinclude> | ;Description:Gets the environment variable value for the <tt>key</tt> <noinclude>via the [[Java API]]</noinclude> | ||
:''See also:'' [[getLoggedInUserInfo]] | |||
'''Syntax''' | '''Syntax''' | ||
:<syntaxhighlight lang="java" enclose="div"> | :<syntaxhighlight lang="java" enclose="div"> | ||
import static com.platform.api.CONSTANTS.*; | |||
... | |||
String = Functions.getEnv(String variable) | String = Functions.getEnv(String variable) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 16: | Line 20: | ||
|- | |- | ||
| ENV.USER.ID || Logged in user's ID | | ENV.USER.ID || Logged in user's ID | ||
|- | |- | ||
| ENV.USER.USER_NAME || Logged in user's username | | ENV.USER.USER_NAME || Logged in user's username | ||
Line 24: | Line 26: | ||
|- | |- | ||
| ENV.USER.COMPANY_NAME || Logged in user's company name | | ENV.USER.COMPANY_NAME || Logged in user's company name | ||
|- | |||
| ENV.USER.EMAIL || Logged in user's email | |||
|- | |||
| ENV.USER.TENANT_ID || The ID of the tenant the user is logged in to | |||
|- | |- | ||
| ENV.USER.TIME_ZONE || Logged in user's timezone | | ENV.USER.TIME_ZONE || Logged in user's timezone | ||
Line 30: | Line 36: | ||
|- | |- | ||
| ENV.COMMUNITY.TENANT.ID || The community tenant ID | | ENV.COMMUNITY.TENANT.ID || The community tenant ID | ||
|- | |- | ||
| colspan="2"| | | colspan="2"| | ||
Line 42: | Line 44: | ||
|- | |- | ||
| ENV.ISV.RECAPTCHA_PUBLIC_KEY || Key used when verifying that the system is interacting with a person. ''Learn more: [http://google.com/recaptcha/learnmore recaptcha]. | | ENV.ISV.RECAPTCHA_PUBLIC_KEY || Key used when verifying that the system is interacting with a person. ''Learn more: [http://google.com/recaptcha/learnmore recaptcha]. | ||
|} | |} | ||
Line 57: | Line 54: | ||
String userID = Functions.getEnv(ENV.USER.ID); | String userID = Functions.getEnv(ENV.USER.ID); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<noinclude> | |||
[[Category:Utility]] | |||
</noinclude> |
Latest revision as of 01:50, 26 November 2014
- getEnv(String key)
- Description
- Gets the environment variable value for the key via the Java API
- See also: getLoggedInUserInfo
Syntax
- <syntaxhighlight lang="java" enclose="div">
import static com.platform.api.CONSTANTS.*; ... String = Functions.getEnv(String variable) </syntaxhighlight>
Environment Variable Constants
- The following constants can be used as keys to access the environment variables:
Key Variable ENV.USER.ID Logged in user's ID ENV.USER.USER_NAME Logged in user's username ENV.USER.FULL_NAME Logged in user's full name ENV.USER.COMPANY_NAME Logged in user's company name ENV.USER.EMAIL Logged in user's email ENV.USER.TENANT_ID The ID of the tenant the user is logged in to ENV.USER.TIME_ZONE Logged in user's timezone ENV.COMMUNITY.TENANT.ID The community tenant ID ENV.SESSION.ID ID of the logged in user's session ENV.ISV.RECAPTCHA_PUBLIC_KEY Key used when verifying that the system is interacting with a person. Learn more: recaptcha.
Return
- The value of the environment variable as a String.
- Example
- This example calls getEnv to get the current user's identifier.
- <syntaxhighlight lang="java" enclose="div">
String userID = Functions.getEnv(ENV.USER.ID); </syntaxhighlight>