Try ERPNext Buy Support Partners Foundation

Fetch Field When Doctype created from Dashboard

When I generate a material request from a sales order, I would like it to fetch the customer and the customers mobile onto the material request form. This is because many of our customers have items on order with us and it’s faster just to call them from the material request list.

I have a link field called customer_name and a data field called mobile number on Material Request.

The mobile number is fetched just fine if I create a new Material Request from the Material Request List page and then select a customer. However if I create the Material Request by pushing the “+” sign from the Sales Order dashboard, the Customer is fetched, but the number is not.

I’m using this script:
cur_frm.add_fetch(‘customer_name’, ‘mobile_no’, ‘mobile_number’);

I’ve also tried using the script found in this post Cur_frm.add_fetch from another doc dashboard

Figured it out. I think as of V12 you’re meant to do this through Customize Forms, or at least that’s what is working for me. Create a link field first, in my case called Customer Name, then create a data field, in my case called Mobile Number, and there will be a Fetch From text box, enter the name of the linking field, I called my link field “Customer Name”. I probably should have left it as “Customer”. Anyway for the purpose of illustration this is probably a good thing, as you need to use whatever name you assigned, which once saved became “customer_name”.

So the code to enter into Fetch From was, in my case: customer_name.mobile_no

“mobile_no” being the name of the field in the database that contains the mobile phone number.

It works like a charm. I feel like I actually knew this 6 months ago and forgot. I read way to many forum posts to find this, I mean I must have read at least 50 odd posts. That’s cool, but it really needs to be in the documentation.
I