Get Set Values JavaScript Quick View Form - Dynamics

527 Views Asked by At

Im trying to retrieve a value from a quick view form of a related entity and trying to set a hidden field on this form so I can use the value to send out an email. I have got the below code so far, but have been unable to get it to work. New to this so any help is appreciated.

function getEmail(){
    
    if (Xrm.Page.getControl('QuickviewControl1611244448861_QuickviewControl1611244448861_associateavailability_email') != null)
    {
            var emailQuickForm = Xrm.Page.getControl('QuickviewControl1611244448861_QuickviewControl1611244448861_associateavailability_email');
            var email = emailQuickForm.getAttribute().getValue();
            //set email on parent form 
var newEmail = Xrm.Page.getAttribute("email").setValue(email);
            console.log(newEmail);

    }
    else{
        return null;
    }
}

I should add that this is runs on the "onSave" event of the record.

0

There are 0 best solutions below