How to fetch the value City from address doctype to Customer doctype?

Hi Teams,
I have create one custom filed name is City, in customer doctype.
When user enter the address of the customer then the city filed fetch from the address doctype to customer doctype is this possible please help

Thanks

you can use below script.

1 Like

Try this on customer.js file:
cur_frm.add_fetch("address", "city", "city")

1 Like

Hi Lokesh,

Will this script work in case of Manufacturing Date as well ?

Thanks
Regards

Hi Essential_Queries,
Please elaborate more about your requirement.

Hi,
Thanks for the reply
Actually I want “Manufacturing Date” and "Expiry Date " to be fetched from Batch master to Sales invoice item table

Yes. This script will work in this case too. You just have to take fields on sales invoice item table, batch as link field and manufacturing date and expiry date will be read only fields.
You can use script like this:
cur_frm.add_fetch("batch", "manufacturing_date fieldname on batch master", "manufacturing_date fieldname on sales inv item")
cur_frm.add_fetch("batch", "expiry_date fieldname on batch master", "expiry_date fieldname on sales inv item")

Please let me know if I understand you correctly

[quote=“lokesh, post:7, topic:54994”]
You just have to take fields on sales invoice item table
[/quote]…does it mean create the fields on sales invoice item table ?

And last regarding script …where am I supposed to write it …Am I supposed to write in the “fetch from” in sales invoice items table where i create the manufacturing date

Thanks for your patience
:slight_smile:

For your 1st question.
Yes. You need to create fields on sales invoice item table but don’t directly add it from doctype. Sales Invoice is a standard doctype so you have to customize it.
Login by administrator
Search for customize form
On customize form select your doctype i.e. sales invoice item.
Then add fields there.
For your 2nd question
Write this script on sales_invoice.js file.

1 Like

Yes I got it now :slight_smile:
But I am still confused about “batch” :frowning: … Do I have to add this in sales invoice Item table similar to manufacturing dates & expiry date.

Do you mean this one

Don’t you have access to the back end script?

I don’t think so …i have just done customisation in it …never did back end scripting
Will confirm by tomorrow ,as office is over now .

can we get value for city / address from address doctype to any Print format with same method ?

Is there a way to do this without back end script. I am on Cloud instance and we can’t have access to back end. Thank you for your time :slight_smile: