
Runner.pages.PageSettings.addPageEvent( 
	"po_to_qa", 
	"add", 
	"afterPageReady", 
	function(pageObj, proxy, pageid, inlineRow, inlineObject, row ) {
		// Place event code here.
// Use "Add Action" button to add code snippets.

setTimeout(function() {

    var ctrlReferenceNo = Runner.getControl(pageid, "reference_number");

    if (!ctrlReferenceNo) {
        console.log("Reference Number control not found.");
        return;
    }

    if (proxy["preview_reference_number"]) {
        ctrlReferenceNo.setValue(proxy["preview_reference_number"]);
    }

    // Optional: make it readonly
    ctrlReferenceNo.setDisabled();

}, 500);


});







