It's possible to read a parameter from Custom Pref...
# ask-stanley-ai
s
It's possible to read a parameter from Custom Preferences from other scripts?
c
AI generated answer (using internal Slack threads):
Yes, it is possible to read a parameter from Custom Preferences from other scripts. If you define a company script parameter in one script, it can be accessed from another script. This can be done using the N/config module which makes the company script parameter available to all scripts. Here is an example of how you can do it:
Copy code
javascript
var rec = record.load({type: 'scriptdeployment', id: 1234});
rec.getValue('custscript_your_param');
When more than one script needs to use the same parameters, setting the preference to Company is a common practice. This allows other scripts to access the same parameters. However, some developers prefer to use a custom record as it provides more flexibility, though it is a bit more complex. If end users will set up the configuration, you can control the UI for a custom record form more easily and give it a dedicated place, as opposed to company script parameters which are mixed in with all the other company preferences. If you are looking for script parameters fields outside of the script page, you can find them on the General Preferences page. If there are Company Preference level parameters, there should be a Custom Preference tab. However, if you want to see them as an edit option to assign to multiple scripts or change to company preference, this option may not be available. ****** 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.845337033
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.840576231
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.835571289
Please provide your feedback on this answer.