Dynamic Dependancy between DocFields

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

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.

2 Likes

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

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

1 Like

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

Cheers