How to fetch customer name on login on web form

There is a web form with the name “Issue” in ERPNext. In that “customer” is a field and it get fetched on “SAVE” of the new issue. How to fecth the “Customer” field only on “Login”. Similarly, we need the same in other web forms which are custom not standard.

@SMBCATALYST First, welcome to ERPNext community.

You can edit the Web Form that you need and check the box Login Required.

We already checked the box for Login Required. Due to this, the system fetches Customer when we “SAVE” an issue. We require the same when we do “Login”.

@SMBCATALYST Can you please show me a screenshot of the Web Form fields…

on login with website user, web form should fetch “Customer”.

Customer comes on “SAVE”.

@SMBCATALYST What you can do is:

  1. Set the customer field as readonly
  2. Add the following client script
    Assuming that the Customer fieldname is customer.
    This will set the customer field to the current logged in user.
frappe.web_form.after_load = () => {
    frappe.web_form.set_value('customer', frappe.session.user);


I have checked as you suggested. It is not fetching the customer on login.

@SMBCATALYST What is the fieldname of Customer field? Is it customer?

The code I posted for you is based on the documentation and it should be working unless the fieldname of the Customer field isn’t customer.

Yes, it is customer only.

Is there any update on the request?