SuiteScript Error: “INVALID_FLD_VALUE : You have entered an Invalid Field Value” for Custom Field

The error “INVALID_FLD_VALUE: You have entered an Invalid Field Value” Invalid Value details which is returned if there is any instance of setting a field value that is different from the type of value the field is expecting.

The specific field value error above is returned when a time value is set via script to a field of Type = Time of Day.

The user is trying to set a time value (4:29 am) which is in 12-Hour format to a time field, but the User’s preference is set to 24-Hour format. Confirm the User Preference by navigating to Home > User Preferences. Under General Sublist > Formatting > TIME FORMAT.

Note that date and time field’s formats are dependent on the User or Company’s date and time format preferences. If set to 24-Hour format, the field can only accept 24-Hour formatted values, if not, then the error Invalid Field Value is returned. Using 0000-2400 format is found to be accepted at any user preference.

define(['N/record'], function(record){
	var empRec = record.load({
		id: 1280, //record internal ID 
		type: record.Type.EMPLOYEE
	});
	empRec.setText({
		fieldId: 'custrecord_field_id',
		text: '2300'
	});
	empRec.save()
})

will set the time of day to 11:00 PM / 23:00 / 11-00 PM / 23-00 following through the user preference format.

Leave a comment

Your email address will not be published. Required fields are marked *