Use user image in another doctype


How can I use user image in a fileld in an another doctype.
First i have made a field user (link to User) to select user and then
i made a field prof_image as Attach Image and set the value as user.user_image using javascript.

The value (“/files/image.jpg”) is set to the fileld prof_image but the image is not displayed.

It shows a div class=“missing-image” in the place of prof_image field.

I have tried using field type of prof_image as Image and same thing happens.

How can I display the image correctly?

You might have to debug the JS. Does the image show after save?

Hi @rmehta ,

frappe.ui.form.on(“Visitor”, “user”,function(frm)
        "method": "frappe.client.get",
        args: {
            doctype: "User",
            name: frm.doc.user
        callback: function (data) {
            frappe.model.set_value(frm.doctype,frm.docname, "full_name",
                data.message.first_name + (data.message.middle_name ?
                    (" " + data.message.middle_name) : "")+ (data.message.last_name ?
                    (" " + data.message.last_name) : "") );
            frappe.model.set_value(frm.doctype,frm.docname, "prof_image",
                data.message.user_image );

This is my javascript. As i said, prof_image is assigned a value “/files/image.jpg” after execution.
But still image is not displayed even after save.

This is what i see before and after save

Profile Photo