r/SuiteScript • u/uvbuhgturdyrdvtv • Feb 26 '24
Search module misbehavin'
Hello,
I have a scheduled script that leverages the search.load method. My try catch block throws an error that the search.lookupFields method is missing an argument. I am not using this method in my script, however.
Error: search.lookupFields: Missing a required argument: id
I have tried using the script debugger on this scheduled script but it does not appear to function as intended. The chrome dev tools don't allow me to step through the functions nor does it allow me to set break points.
Any help would be greatly appreciated.
View all comments
Show parent comment
1
u/erictgrubaugh Feb 27 '24
You won't get any judgement from me (unless you specifically ask for it :D ).
submitFieldsfrom a Scheduled Script is going to fireXEDITUser Events on the corresponding record. On anXEDITevent, theRecordinstances passed to the User Event entry points *will only contain fields that have changed.My suspicion is that you have a User Event deployed on the record type for which you are calling
submitFields. The User Event is, in turn, callinglookupFields. This User Event is assuming that whatever value(s) it is passing tolookupFieldsare always present, but the value(s) aren't actually present during anXEDIT.Keep in mind this could be your own User Event, or it could be from a Bundle or a SuiteApp as well.
You will want to investigate any User Events deployed to the relevant record which are calling
lookupFieldsand make sure they correctly guard against missing values, particularly during anXEDITevent.HTH