how to create Custom field for General preferences...
# suitescript
z
how to create Custom field for General preferences? It must be accessible from many scripts (Suitelet, Restlet)...
b
z
I did it for script when it is unique (only for that script). Now, I need to create multiple scripts and all of them have to have access to same preferences parameter. As expected, when try to create same paremeter (same id) on the script definition, NetSuite raise error "already exists")
w
I believe you only need to create it in one of the scripts. All the other scripts can access all company script parameters.
s
I have had the same issue. My solution was to create a non-functional Suitelet script (well, actually, it renders a page that just displays all of the script parameter values) and deployment that just acts as a preferences container, and have multiple scripts reference the script parameters from there.
👍 2
Another common solution I see in bundles and apps is to create a custom preferences record type, enforcing that there is only a single record, and storing all settings there.
👍 1
z
yes, that will be final decision... It would be better to provide preference, but ..
b
you would access the single company script parameter from any script using N/config to load the company preferences
you can also use N/runtime and get the preference from the script object, but i distrust it after seeing some caching issues
z
@battk yes I know that, and exactly what I want to do : reading some company preferences from mulitple scripts... Question was : how to create custom general preference field? All I know it is creating script's parameter and setup as company on the listbox... But it is acceptable for single script (even I prefer to have option to create preference outside of script and deployment). In case you have multiple scripts it is confusing that you have to create parameter on the one script and use it on the another...