I can share the script, if that will help. My bigg...
# suitescript
m
I can share the script, if that will help. My biggest question is if there is some sort of relationship in these fields that hiding one would cause another to disappear. Any help is appreciated.
l
I think User Event beforeLoad isn't trigerred on view mode.... you can use a client script on pageLoad and remove the elements on DOM
b
other way around. client scripts arent triggered by view
but you can use a user event beforeload to add a client script file that cant use any entrypoints
share the script to see if you are doing weird stuff
m
Copy code
/**
 * Module Description
 * 
 * Version    Date            Author           Remarks
 * 1.00       20 Mar 2020     ------
 *
 */

var parmAllowedRoles = nlapiGetContext().getSetting('SCRIPT', 'custscript__pi_ue_project_taskp0'); // Allowed Roles

/**
 * The recordType (internal id) corresponds to the "Applied To" record in your script deployment. 
 * @appliedtorecord recordType
 *   
 * @param {String} type Operation types: create, edit, view, copy, print, email
 * @param {nlobjForm} form Current form
 * @param {nlobjRequest} request Request object
 * @returns {Void}
 */
function __pi_ue_project_taskBeforeLoad(type, form, request){

	try{

		if (!isEmpty(parmAllowedRoles)) {
			var aRoles = parmAllowedRoles.split(',');
			if (aRoles.length > 0) {
				if (aRoles.indexOf(nlapiGetRole().toString()) < 0) {
					form.getSubList('assignee').getField('unitcost').setDisplayType('hidden');
					form.getSubList('assignee').getField('cost').setDisplayType('hidden');
				}
			}
		}
		
	}catch(e){
		var nle = nlapiCreateError(e);
	    err = {
	        stacktrace: nle.getStackTrace(),
	        reasoncode: nle.getCode(),
	        message: nle.getDetails(),
	        event: nle.getUserEvent(),
	        id: nle.getId(),
	        internalid: nle.getInternalId()
	    };
		nlapiLogExecution('error', '__pi_ue_project_taskBeforeLoad', JSON.stringify(err));
	}

}

/**
 * The recordType (internal id) corresponds to the "Applied To" record in your script deployment. 
 * @appliedtorecord recordType
 * 
 * @param {String} type Operation types: create, edit, delete, xedit
 *                      approve, reject, cancel (SO, ER, Time Bill, PO & RMA only)
 *                      pack, ship (IF)
 *                      markcomplete (Call, Task)
 *                      reassign (Case)
 *                      editforecast (Opp, Estimate)
 * @returns {Void}
 */
function __pi_ue_project_taskBeforeSubmit(type){
 
}

/**
 * The recordType (internal id) corresponds to the "Applied To" record in your script deployment. 
 * @appliedtorecord recordType
 * 
 * @param {String} type Operation types: create, edit, delete, xedit,
 *                      approve, cancel, reject (SO, ER, Time Bill, PO & RMA only)
 *                      pack, ship (IF only)
 *                      dropship, specialorder, orderitems (PO only) 
 *                      paybills (vendor payments)
 * @returns {Void}
 */
function __pi_ue_project_taskAfterSubmit(type){
  
}

function isEmpty(stValue) 
{
   if ((stValue == '') || (stValue == null) || (stValue == undefined) || (stValue.length == 0)) {
        return true;
   }
   return false;
}
b
your script remind me of netsuite professional services scripts
that said, a simplified version works on view
and edit
i tossed out the unnecessary stuff:
Copy code
function beforeLoad(type, form, request) {
  form.getSubList("assignee").getField("unitcost").setDisplayType("hidden");
  form.getSubList("assignee").getField("cost").setDisplayType("hidden");
}
m
Thanks for the help. I believe that the issue is related to something else in this NetSuite instance. I deployed my script as-is in a test environment and it works fine.
I figured it out (mops brow after big investigation) There was another script, created in 2015 that was trying to do this exact same thing, but poorly. I turned it off and my script works now. Thank you for your help.