Chuyển tới nội dung chính

Fetch the entire address text on a custom field

This article will help you to add a custom field for fetching full addresses on any DocType, using a 3 step approach.

Step 1. Cosmetic customisations on the required DocType

We would first need to add two new fields on the DocType for fetching addresses:-

a) A field of type 'Link' which points to our Address master

b) A field of type 'Read Only' which would display the full address

Take note of the variable names of the new fields you create. This information will be required later in the process.

For information on creating custom fields on a DocType you can refer to the following link - Custom Fields in ABNERP

Once this step is done you should have two new fields on the selected DocType, as illustrated below:-

Step 2. Adding a Client Script for fetching the full address from our Address master

Search for 'Client Script' on the search bar, and create a new Client Script. Select the required DocType on which we need to fetch the address on.

In the section for the script paste the following Client Script:-

frappe.ui.form.on(\