Runway
September 6, 2024, 5:44am
1
Hello, I create one custom field custom_site_location in employee doctype and link Custom doctype Site Location
Site location doctype
Employee doctype add custom field option in come doctype only id like,
How to get employee doctype added custom field custom_site_location options in Site Location doctype id with another field Location Name value
1 place
1
wrfer
Runway
September 6, 2024, 6:13am
3
Ok @NCP it’s work ok now i want to like
1: wrfer
So how to get this type in list option without change in naming rule
NCP
September 6, 2024, 6:18am
4
It’s possible, but if id field and name is both are there.
please check the concept of Formatter For Link Fields
Hi @kiranshegde ,
Please apply the client script for that.
Here I share the full code so please add it to the client script.
frappe.form.link_formatters['Item'] = function(value, doc) {
if(doc.item_code && doc.item_name !== value) {
return doc.item_name;
} else {
return value;
}
};
Before:
[image]
After
[image]
Reference: More detail for check the documentation with the script .
I hope this helps.
Thank You!
1 Like
Runway
September 6, 2024, 7:02am
5
Hello @NCP you can tell me which doctype on i can apply Formatter For Link Fields script
NCP
September 6, 2024, 7:03am
6
For your case, Employee doctype.
Runway
September 6, 2024, 7:36am
7
Hello @NCP I apply Employee doctype on client script
frappe.form.link_formatters[‘Site Location’] = function(value, doc) {
if (doc && doc.location_code && doc.location_name) {
return ${doc.location_code} : ${doc.location_name}
;
} else {
return value; // Default return if the fields are not found
}
};
but it not work
NCP
September 6, 2024, 7:40am
8
Without understanding a concept, how can I explain? I already provided lots of posts referencing the forum. so check it.
Runway
September 6, 2024, 7:41am
9
Ok @NCP I will check it Thanks