PRD workflow form - Email not fetching in the next form field as expected

Hi,

I am creating a form in which in the "search" field, I have used DNLookup to look for a User object in the eDirectory. In the next form field, I want the email should auto-populate of the User selected in the "search" field.

Below is the function that I am using: 

var attr= form.getValue("search");

if(attr>""){
field.setValues(IDVault.get(null,form.getValue("search").toString(),'user','Email'));
}

The Email is not getting auto-populated in the form. Is there anything that needs to be checked?

Regards,

Shuchita