Anyone has a good pattern to get all "real" fields...
# suitescript
w
Anyone has a good pattern to get all "real" fields on a form+sublists and only allow edits on whitelisted fields? In UE you can do newRec.getFields() and newRec.getSublistFields(), but that gives you a lot of junk that you need to sort through and exclude. Like "sys_id", "wfPI", "custrecords_fieldid_display" etc.. Since we're currently working with a custom record, I can query the tables "customfield" and "customrecordtype" to get all fields, but that won't work with standard fields.
s
Are we talking about UE here? Just giving ideas, if it's beforeSubmit then loop through the oldRec vs newRec? I wrote something similar before with CS, but since it triggers per field the flags were a lot more apparent to find the whitelist. We had a client with a similar requirement, and no kidding, in the end my colleague opted to use disable fields in the workflow to do it...
w
Yeah, it's UE. We have a custom record that keeps track of which fields are OK to edit. The issue is that NS adds a bunch of additional internal fields that has been changed for some reason.
s
idk how you're trying to implement it but i think it's do-able with your setup already although inefficient, what problems are you encountering? are you trying to overcome the inefficiency?
from my understanding depending on context, newRecord doesnt contain all the fields, mostly only the fields changed So if I were you I'd loop through them and see/check if they're different with oldRecord From my knowledge thats the best I could do
w
Thank you for your thoughts! I think we might need to move to a blacklist approach if we want it to be sustainable.