ERPNext Conference 2019* ERPNext.com Blog

Dynamic Dependancy between DocFields

customization

#1

Hello All,

We are looking to use ErpNext for Customer Support UseCase (Farmer Distress Helpline)
We are trying to customise Issue Doctype in Support.
We wanted to show certain Docfields based upon value selected in another entered Options.
For Example :
Imagine there are 3 Doc Fields :

  • Issue Type (Crop Loan, Crop Loss)
  • Bank - This field should be shown when the Issue Type is CropLoan
  • Damage % - This Field should be shown when the Issue Type is Crop Loss

In Addition to the Above, can a whole set of fields in a section be loaded depending on a particular Value selected in a Doc Field.
We can add more clarity and examples as the discussion proceeds.

Cheers,
Harsha


#2

go to customize doctype -> field bank. Here you need to change depends on

for your case it should be something like:
eval: doc.issue_type =="Corp Loan"

on Damage % it should be
eval: doc.issue_type =="Corp Loss"

For section you, can apply similar conditions in section break field.


#3

Hi Mukesh,

Thankyou I was able to understand and make necessary changes.
Another doubt I had was on how to make filter work in Select Field based on another select field. For Ex:
Two Fields : Country & State
Based on selection of Country , the states should auto popualate/filtered.
We tried scouting around in forums & also within existing doctypes but couldn’t find a out of the box way of doing this.
Thanks in advance

Cheers,
Harsha


Auto fill a field based on another field
Fill a dropdown with cities depend on country select
#4

you need to write custom script, use below link to understand:

https://frappe.io/docs/user/en/guides/app-development/overriding-link-query-by-custom-script


#5

Thanks @Mukesh_Variyani, will try to test run some of these, and understand more.

Cheers