BASIC linking of fields

Trying to just grasp the basics here as I’ve paid someone do a lot of the customizations for me but need to manage some on my own.

If I am on a doctype and wish to pull in a field from another doctype, I create the field and then what do I select? LINK or DATA?

For example, on Payment Entry doctype, I need to add supplier address as we print this on the check. First step is to pull in the Supplier Address from the Supplier doctype but how to accomplish this?

Another example, I want to pull in the field called FORM from my Item doctype to my Sales Order Item table. Create the field and then how do I get the data from the Item?

Seems like I should be able to simply call the field from the other doctype?

Hi Heather, You can look up this documentation for fetching values from another doctypes.

Basically, you need a link field i.e the doctype from which you want to pull a field, in your case it would be Supplier. So, make a link field Supplier in the payment entry doctype. Then, add another data field, which should be Address. Now, go to Custom Script for Payment Entry and add an add_fetch method as per the documentation I have referred above,

Thanks so much for pointing me to this documentation and explaining it! I’ve read that but never understood that I really needed two fields - a link field and a data field - to accomplish this.

So, on the payment entry screen, it already has party type where we select supplier. Then it has a link field for party, where we select the supplier’s company name. Those are just standard default fields on the form. If I’m understanding, I’d create a field for address as a data field. Then, go to custom script for payment entry and use:
add_fetch(party, supplier_address, address)

Does this seem correct? I guess I don’t understand how it knows where to pull the supplier_address from but hopefully it does?

That link is now: Custom Script Fetch Values From Master

1 Like