I have an issue with JavaScript populating a text field value into "To" lookup in the email form. Current code works fine in the classic interface but it's not working in UCI. Here is the existing code which gets an email address from category field and populates "To" field.
function addEmailAddress(executionContext) {
var formContext = executionContext.getFormContext();
var emailAddress = formContext.getAttribute("category").getValue();
var obj = new Object(); //create the unresolved object
obj.name = emailAddress;
obj.category = 3;
obj.data = emailAddress;
obj.type = "9206";
var toField = formContext.getAttribute("to");
toField.setValue([obj]); //if 'to' field is null, just override it
}
Any solutions would be greatly appreciated.