How to get a script parameter-based User preferenc...
# ask-stanley-ai
a
How to get a script parameter-based User preference in a context or script-type that is not user-triggered, such as a scheduled workflow?
c
AI generated answer (using internal Slack threads):
In SuiteScript 2.0, you can get a script parameter-based User preference in a context or script-type that is not user-triggered, such as a scheduled workflow, by loading the script deployment record and then getting the value of your parameter. Here is a sample code snippet:
Copy code
javascript
var scriptObj = runtime.getCurrentScript();
var parameterValue = scriptObj.getParameter({name: 'custscript_my_script_parameter'});
In this example,
custscript_my_script_parameter
is the ID of the script parameter you want to retrieve. If you need to get a parameter from a different script, you can load the script deployment record and then get the value of your parameter. If you want to add a new field to the Company General preferences, you can do it on most script types (i.e. User Event, Map/Reduce, Client, etc). When you create a script record you can add Parameters - if set to “Company” preference, they will be displayed on Company General Preferences. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.843603253
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.833990574
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.832446933
Please provide your feedback on this answer.
a
No, that would only get the stored value on the script deployment record, not the value of that script parameter as it is stored in a given user's preference