darrenhillconsulting
11/27/2024, 4:28 PMCeligo AI
11/27/2024, 4:28 PMAI generated answer (using internal Slack threads):To access General Preference values via SuiteScript 2.1, you can use the
runtime
module's getCurrentScript()
method, followed by the getParameter()
method. This allows you to access the parameters of the current script, which includes the General Preferences.
Here is a sample code snippet:
javascript
var runtime = require('N/runtime');
var myPreference = runtime.getCurrentScript().getParameter({name : 'custscript_my_preference'});
In this example, custscript_my_preference
is the script parameter you want to access. Replace 'custscript_my_preference'
with the actual name of your preference.
Please note that this method only works for script parameters, and not for all General Preferences. If you need to access a preference that is not a script parameter, you may need to create a custom record or field that stores this preference, and then access that record or field via SuiteScript.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
11/27/2024, 4:28 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.834466219
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.829730034
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.829371691
Celigo AI
11/27/2024, 4:28 PM