I want to hide a certain sublist on a record for a...
# suitescript
z
I want to hide a certain sublist on a record for a particular role using SuiteScript (it doesn't seem like it's possible to hide this sublist normally, so I'm using SuiteScript as an alternative method.) There is a SuiteAnswer that has the exact solution I am looking for, except it doesn't actually work. The id is 62616, and it only contains the following code snippet:
Copy code
function userEventBeforeLoad(type, form, request){
var frm = form.getSubList('XXX');
frm.setDisplayType('hidden');
}
Right now I am using a ue script that looks like this:
Copy code
/**
 * @NApiVersion 2.x
 * @NScriptType UserEventScript
 * @NModuleScope SameAccount
 */
define(['N/record', 'N/ui', 'N/ui/serverWidget'],
/**
 * @param {record} record
 * @param {ui} ui
 * @param {serverWidget} serverWidget
 */
function(record, ui, serverWidget) {
	return {
		beforeLoad: function (type, form, request){
            var form = form.getSubList('item');
            form.setDisplayType('hidden');
		}
	};
});
I've never seen a function loaded with anything but the context object, so I'm a little lost on what exactly is going wrong. It appears I am getting a Null Reference exception on getSubList.