I have a doctype with fields Field1
and Field2
which have data structure as below:
Field1 | Field2
-----------------
A 1
A 2
B 1
B 3
-----------------
I want to get the Field2 from other doctype with a Link field (with filter for Field1)
As you can see, the data is unique when Field2 is together with Field1.
I can use Auto Name such as format:{Field2}-{Field1}
But using this Auto Name will result in the dropdown displays Field2-Field1
.
What I want is the dropdown to only display Field2
.
The set_query script I use:
frm.set_query( "linkfield", () => {
return {
fields: [ "field2" ],
filters: {
"field1": "A"
}
}
} );
How do I achieve this?
What should I fill in the Auto Name, Title?
Or if I really have to use such Auto Name, what args should I use in the set_query script?
Thank you