Try ERPNext Buy Support Partners Foundation

Fetch Values from Masters

Dear All,

For a particular Sales Invoice, I need to fetch the Bank Account No from Bank Account when a particular user selects a bank account.

Referring to the above Snapshot, I was able to call the Customer vat no cf for a particular customer using the following custom script.

cur_frm.add_fetch(‘customer’,‘customer_vat_no_cf’,‘customer_vat_no_cf’)

However, for the Bank Account No, I have tried the following script as well the fetch from values and it is not working.

Script:

cur_frm.add_fetch(‘Bank Account’,‘bank_account_no’,‘bank_account_no’)

Fetch From:

Can anyone please help calling the Bank Account No and advise if there are any issues with the above?

Best Regards,

Kartive.

Hi @Kartive_lfc,

the fetch_from way should be the easiest, I think the only issue could be the name of the field, where the link to the bank account is set. Is it really called “account_name”? To be noted, changes only appear after the form has been reloaded, but I guess this is obvious…

Hope this helps.

@lasalesi

In Fetch from, I have updated it to bank_account.bank_account_no.

bank_account is a link field I created to call the Bank Account

bank_account_no is where I want the Bank Account No to appear automatically after selecting the Bank Account.

However, still its not working.

Any Idea why?

Best Regards,
Kartive.

If fetch_from is now set to “bank_account.bank_account_no”, the field is set to read-only (not essential, but a common option for a fetch field), and the browser form view has been refreshed, I don’t see another pitfall why it should not work… Anything in the browser console (F12)?

@lasalesi Is it mandatory to set the field to read-only?

Best Regards,

Kartive

No, it is not mandatory, but I guess good practice for a static fetch…