HI,
I am trying to get a field value from Quick View form and need to set that value in another field. In the main form properties I have added this js in event library and in Event Handlers added sdk.formOnLoad to load this form onLoad.
I didnt do any event handlers in the fields where the value should set from quickview. I am able to access the quick view field and show in alert. But I couldn't set that value in the local field.
var Sdk = window.Sdk || {};
(function () {
'use strict';
// Code to run in the form OnLoad event
this.formOnLoad = function (executionContext)
{
var formContext = executionContext.getFormContext();
formContext.getAttribute("Nameblock").addOnChange(DisplayBlockId);
}
function DisplayBlockId(executionContext){
var formContext = executionContext.getFormContext();
var quickViewControl = formContext.ui.quickForms.get("BlockInformation");
if(quickViewControl != undefined){
if(quickViewControl.isLoaded()){
var blockidvalue = quickViewControl.getControl("blockid").getAttribute().getValue();
alert(blockidvalue);
formContext.getAttribute("blocktest").setValue(blockidvalue);
} else {
// Wait for some time and check again
setTimeout(DisplayBlockId, 10, executionContext);
}
} else {
formContext.getAttribute("blocktest").setValue("No value");
return;
}
}
}).call(Sdk);
I am able to see the field value in alert but not able to set the accessed value in field.