I would like to combine a Notes field with other in a script, but if the Notes field is empty I wish to display just the other fields.
I have created a test database with a test script as follows:
var notes_id = 'fld-9d8543d9d39f409194349c1a855d7728';
var notes = record.getFieldValue('fld-9d8543d9d39f409194349c1a855d7728');
var new_work_address_id = 'fld-943ab25fd0de42e7b8d1e5487c6a358b';
var new_work_address = record.getFieldValue('fld-943ab25fd0de42e7b8d1e5487c6a358b');
if (notes == "") {
result = new_work_address
} else {
result = new_work_address + "\n\n" + notes;
}
result
But if the Notes field is empty the result is the content of new_work_address plus plus the word ‘undefined’
Is there a way to test for whether a Notes field is empty?
Hi Victor
if (notes == undefined) {
}
or
if (notes == null) {
}
For example:
function Check_Notes() {
var notes = record.getFieldValue('fld-d2953777d8f5442d8d4d5a07f93e9c0e');
if (notes == null) {
return "no note value";
} else {
return "note: " + notes;
}
}
Check_Notes();
Brendan,
Thank you for the information.