nlapiGetContext 应用与介绍
var currentContext = nlapiGetContext(); var procId = currentContext.getSetting('SCRIPT',ncConst.BGP_ProcessIdParam); 去读取这个值,难道这个值可以动态被设置? |
错了, 这个值不可以动态设置!这个Type:SCRIPT是UI级的手工在script地方设置,
下面介绍取值的
getSetting(type, name)
Returns a system or script setting
Important: SCRIPT is the only type supported in Client SuiteScript.
Parameters
? type{string}[required] - The type of script/system setting. Possible values include:
? SCRIPT - script parameter (defined per script)
? SESSION - session variable (volatile setting defined per session)
? FEATURE - returns T (enabled) or F (disabled) depending on whether a feature is
enabled. In the SuiteScript Reference Guide, see "Feature Names and IDs" o
page 335 for all NetSuite feature names and internal IDs.
? PERMISSION - returns permission level: 0 (none), 1 (view), 2 (create), 3 (edit), 4
(full). In the SuiteScript Reference Guide, see "Permission Names and IDs" o
page 327 for all NetSuite permission IDs.
? name {string} [required]- The name of the script/system setting
Important: You must use the nlobContext.getSetting method on nlapiGetContext to reference
script parameters. For example, to obtain the value of a script parameter called
custscript_case_field, you use the following code:
nlapiGetContext().getSetting('SCRIPT', 'custscript_case_field')
Returns
? If type is specified as SCRIPT, SESSION, or FEATURE, a string value is returned. If
type is specified as PERMISSION, an integer value is returned.
-------------------------------------------------------------------------------------------------
下面介绍设置值的:
setSetting(type, name, value)
Sets the value of a script or user-defined setting. Only available in Server SuiteScript.
? type{string} [required] - The type of script/system setting
? SESSION - session variable (volatile setting defined per session)
? name{string} [required]- The name of the script/system setting
? value {string} [required]- The new value for the script/system setting
Returns
? void
所以我们可以知道设置时,仅支持设置SESSION类的东西,其他类不支持。
本文来自博客园,作者:CarlZeng,转载请注明原文链接:https://www.cnblogs.com/backuper/archive/2009/01/05/1369527.html
需求沟通链接 扫客服加群: