we have map/reduce script that is triggered either...
# suitescript
s
we have map/reduce script that is triggered either by time or by user this code sits at the top, the user passes in params how can I check if serchid is empty meaning it was not triggered by the user ?
Copy code
var searchid = runtime
      .getCurrentScript()
      .getParameter({ name: "custscriptinput" });
s
I don't understand the question, you have the variable right there... just check if it is empty?
s
when the user fired script searchid will be a string if the sytem fired it it will be an object
this is what i did but dont love it
Copy code
var loadid = typeof searchid === "string" ? searchid : shipvia.getday(day);
s
I dont think the script parameter will ever be an object, object is not a field type for NS dropdowns
s
correct the parms will be a sting but if params is empty it will return an object
b
typeof null === 'object'
you are using the wrong tool for the job
s
What do you mean ?
b
typeof cant really be used for null checks
basically because typeof will give the same value for a null and a non null value
the example i gave was that
Copy code
typeof null === 'object'
is true
more normal inputs like typeof {} also equal 'object'
s
One of those funny things about js
Do you have a better solution then what I used
s
Have you tried checking the runtime.executionContext to see if they are different? Also you could just get the deploymentId from runtime, if the user triggered it should have a different deployment id than the scheduled one.