Thanks, for the insight. I didn't understood the syntax at first since it's my first time using JS.Hey,
'<div id=buttonPreview>' + '<button onclick="previewDocumentFunction(' + '\'' + Docid + '\'' + ')">Preview</button>' + '</div>'
OnInsert() TESTFIELD(Mandatoryfield);