/
Warn on blank field

Warn on blank field

Use this script to warn a user when a specific field on a document is blank. In many workflows, the required attribute of a field may not be practical to implement, but users still need to be aware when the field is left blank. The document in its original state may not have the required data, but at some point in the workflow it should be added, and users should be notified of such a condition.

The following script will inspect an invoice number field on a PO document. If invoice number is left blank, when the document is opened the Live Field will trigger a browser alert window, notifying the user of this condition.

var viewHash = 'viewed-'+$$inject.properties.document.fileId; if(!sessionStorage.getItem(viewHash)) { sessionStorage.setItem(viewHash, true) if($$inject.fields['Invoice Number']=='') alert('Warning: Invoice Number is blank on this record. Please verify no invoice has been received.'); } return "Invoice Verification Checked";

When applied to a Live Field and that field is applied to an archive with an Invoice Number that is blank, opening the document throws the following browser alert:

 

Related content

Reason Code On Open
Reason Code On Open
More like this
Sum Table Field Values
Sum Table Field Values
More like this
Live Field Developer Guide - Javascript
Live Field Developer Guide - Javascript
Read with this
Annotate Document
Annotate Document
More like this
Row Level Calculations In Tables
Row Level Calculations In Tables
Read with this
Field Properties
Field Properties
More like this