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? I want to get the value for the script parameter stored in a given user's Preferences, and not the value that is stored in the same script parameter's on the Script Deployment record.
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems that you can't directly access a script parameter from a different script in a context that is not user-triggered, such as a scheduled workflow. However, there are a few workarounds you can consider: 1. Company Preferences: You can create script parameters and set the preference as 'Company'. Then, store the value in general preferences. These parameters can be accessed by other scripts. However, it's not clear if this works for scripts with multiple deployments. To retrieve the value, you can use the following code:
Copy code
javascript
runtime.getCurrentUser().getPreference({name: 'your_parameter_name'});
2. Script Deployment Record: Another option is to load the script deployment record and then get the value of your parameter. However, this might not work in all cases as some users reported that the record object didn't have the script parameter value in it. Remember, these are workarounds and might not work in all scenarios. It's recommended to test these methods thoroughly before implementing them in a production environment. ****** 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.859848142
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.854052544
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.849819601
Please provide your feedback on this answer.
a
I think then I would have to store these on custom record instances instead. and give the users a portlet to turn them on and off.