We have an UserEventScript that starts with ```var...
# suitescript
e
We have an UserEventScript that starts with
Copy code
var PROJECT = context.getSetting('SCRIPT', 'custscript_sta_dt_project');
I guess this is a parameter passed in to the script, but I dont understand why. Why would you pass in a param and not just read it from a record?
s
Essentially, depending case by case, sometimes for parameters coded it's better this way if it changes by execution or if it's something to be maintained by administrators without the need to change hard coded parameters in the script
Say usecase 1 we need to use parameters 1, usecase 2 we source it for parameters 2, or due to the time of executions reasons and not because structurally or in the core some field in the record etc
E.g, if you always need to forward date 60 days on the duedate, scripting 60 on this scripted might give you more flexibility if you need to change it to 30 days if policy changes, rather than changing some const in the script, and it can be more optimal for a global change on this script rather dig in countless libraries for this const somewhere
For non-development related sysops roles
e
I think I understand.
So, in this case I have a UserEvent for a record type:
Item Fulfillment
with an after-submit script It has a param
custscript_sta_dt_project
of type:
List/Record
of record:
Project Type
The script has:
Copy code
var PROJECT = context.getSetting('SCRIPT', 'custscript_sta_dt_project');
Will I then get the project type for the Item fulfillemts that the user just edited?
And couldn’t that just be read from the item fulfillment with something like
nlapiGetFieldValue('project');
?
b
you can just imagine that the script parameter is a custom field
e
Ok, so custom fields can be read by the nlapi in the same way?
b
there are choices on where you can set that custom field
none of which are on an item fulfillment
e
I understand 👍 Thank you