/
Reason Code On Open
Reason Code On Open
In scenarios where security is paramount, customer may want to force users to provide details on why they are accessing a document. Use this script to force users to provide a reason for accessing a document when opening.
var viewHash = 'reasons-'+$$inject.properties.document.fileId;
if(!sessionStorage.getItem(viewHash)) {
let reason = window.prompt('Accessing this document requires a reason code to proceed. Provide a reason, or click Cancel to exit.');
if(reason == null || reason == '')
window.close();
sessionStorage.setItem(viewHash, true)
let reasonsArray = $$inject.fields['Reason Codes'];
reasonsArray.push(reason);
$$inject.fields['Reason Codes'] = reasonsArray;
$$inject.save();
$$inject.notify.info("Document auto-saved.");
return "Reason code collected."
}
return "Reason already set."
, multiple selections available,
Related content
Live Fields
Live Fields
More like this
Sum Table Field Values
Sum Table Field Values
Read with this
Warn on blank field
Warn on blank field
More like this
Live Field Developer Guide - Javascript
Live Field Developer Guide - Javascript
Read with this
Geolocation
Geolocation
More like this
What's New 6.3
What's New 6.3
Read with this