<@U9U62UJMD> This is for SS 1.0 you can easily ada...
# suitescript
a
@fkrauthan This is for SS 1.0 you can easily adapt it...
e
you know you can clear all fields with an empty string? This could really be simplified to if checkbox,
'F'
, otherwise
''
a
@errol Actually you can't this is why wrote that function...
e
.. but you can… are you sure you just can’t use null to clear currency and selects?
i just tested and empty string works for dates
a
pretty sure, otherwise I would not write that function for no reason...
SS 1.0?
e
both… i have been writing suitescript for over 8 years and never have had to do such function. always use’d empty string..
just pointing it out to maybe help you in the future… if you don’t want to try what i am saying.. thats fine.
a
Well you are lucky... I have to write that function to clear fields on Copy in Client Script...
Copy code
function clearFields(){

	const clearMethod = {
		currency: '',
		select: '',
		date: null,
		datetime: null,
		checkbox: 'F',
		text: null,
		datetimetz: null
	};

	var fieldsToClear = [
		'custitem_nes_sizedescription','custitem_nes_materialplating','custitem_nes_productlength',
		'custitem_nes_closure','custitem_nes_webweight','custitem_nes_productwidth','custitem_nes_productheight',
		'custitem_nes_diameter','custitem_nes_pendantwidth','custitem_nes_pendantheight','custitem_nes_pendantlength',
		'custitem_nes_chaintype','custitem_nes_stonesize','custitem_nes_stonesettings','custitem_nes_stoneshape',
		'custitem_nes_webstonecolor','custitem_nes_webdescription','custitem_nes_webname','custitem_nes_groupondescription',
		'custitem_nes_speced','custitem_nes_charmheight','custitem_nes_vip','custitem1','custitem_nes_widthuom',
		'custitem_nes_heightuom','custitem_nes_activeaafescom','custitem_nes_activeamazondropship','custitem_nes_activebelkcom',
		'custitem_nes_activebbb','custitem_nes_activebjscom','custitem_nes_activebluestemcom','custitem_nes_activeburlingtoncom',
		'custitem_nes_activeebay','custitem_nes_activeevine','custitem_nes_activehsndropship','custitem_nes_activegiselle',
		'custitem_nes_activegrouponmarketplace','custitem_nes_activejane','custitem_nes_activejclub','custitem_nes_activejcpcom',
		'custitem_nes_activatekmartcom','custitem_nes_activatekohlscom','custitem_nes_activelandtcom','custitem_nes_activemacyscom',
		'custitem_nes_activenordstromcom','custitem_nes_activenordstromrack','custitem_nes_activeoverstock','custitem_nes_activequibids',
		'custitem_nes_activesamscom','custitem_nes_activatesearscom','custitem_nes_activeshopkocom','custitem_nes_activestagestorecom',
		'custitem_nes_activesteinmartcom','custitem_nes_activetargetcom','custitem_nes_activetophatter','custitem_nes_activetorreycommerce',
		'custitem_nes_activewalmartcom','custitem_nes_activewalmartmarketplace','custitem_nes_activewish','custitem_nes_activedsw',
		'custitem_nes_activewish','custitem_nes_zulilyupc','custitem_nes_magicdatecreated','custitem_nes_magicusercreated','custitem_nes_binlocation_updating',
		'custitem_nes_weightprice','custitem_nes_weightcost','custitem_nes_movementtype','custitem_nes_waterresistance','custitemcustomer_cix',
		'custitem_nes_stylenumber','custitem_nes_datecreated','custitem_nes_assignupc','custitem_nes_lastinvoicedate','upccode','custitem_nes_barcode',
		'custitem_nes_lastreceiptdate','custitem_lastreceiptcost','custitem_nes_last_confirm_cost','custitem_nes_last_confirm_order_date','custitem_nes_lastinvoiceprice',
		'custitem_nes_binlocation','custitem_nes_overstockbinlocation'
	];

	for (var x =0; x<fieldsToClear.length; x++){
		var oField = nlapiGetField(fieldsToClear[x]);
		var clearType = oField.type;
		nlapiSetFieldValue(fieldsToClear[x], clearMethod[clearType]);
	}

}
I will try it next time and see if I don't get any error...
e
im not saying you didn’t.. i’m just saying you didn’t need to. I promise you can use empty string.