How to fetch form's formname or scriptid in before...
# suitescript
j
How to fetch form's formname or scriptid in before load event? ---------------------------------------------------------- I have a UE before load script that needs to run only in certain transaction forms. I've got it working successfully using the form's internal id as the criterion for whether to execute. Of course, I don't want to enumerate internal ids for this purpose. I use a convention in the formname and scriptid that would allow me to determine whether to execute by looking for a certain string pattern in either. Problem is, for the customform field, record.getValue returns the internal id and record.getText returns undefined (since I haven't previously used setText on the customform field). Is there some other means by which I can fetch either the textual formname or scriptid of the custom form?
a
I understand your logic and what you want to accomplish, however, my recommendation is that you use internal IDs as much as you can and avoid using text or name_ids that can be changed, you sure want to avoid external and very possible changes to break your entire script/logic and that is exactly what can happen if you rely on text or name_ids(both can change). You can use a constant/file(module) or object(variable) to store the IDs for your script logic and/or rely on script parameters of different types to accomplish what you want.
j
Thanks, and I will seriously consider your advice. To the original question, though -- do you know of a way to fetch the formname or form scriptid in the beforeload entry point?
a
No, I don't; since this is not standard(or best) practice in NetSuite, what you are trying to do in the way you want to do it makes this fall into the dark (hack) side of NetSuite (meaning no documentation, no support, it can break tomorrow).