In iVendNext, linked masters (e.g., Customers, Items, Contracts) store centralized data that multiple documents reference. Manually re-entering this data wastes time and risks errors. This guide explains how to auto-fetch information from linked masters into your transactions using field mapping, scripts, and best practices.
Automate data transfer for:
✔ Customer/Vendor Details (e.g., VAT ID, Payment Terms).
✔ Product Information (e.g., Description, UOM).
✔ Standardized Templates (e.g., Terms & Conditions).
If a Link Field (e.g., customer) points to a master, and both documents share fields with the same name, iVendNext auto-populates the data.
Add Matching Fields:
In your document (e.g., Sales Invoice), add fields with names identical to the master (e.g., vat_id).
Create the Link:
Ensure your document has a Link Field (e.g., customer) pointing to the master (e.g., Customer).
Test:
Select a Customer → vat_id auto-fills.
Note:
Field names must match exactly (e.g., vat_id ≠ vat_number).
Works for Text, Date, Check, and Number fields.
If field names differ between documents (e.g., master uses tax_id, but your form uses vat_number), use the add_fetch method.
// In Sales Invoice Custom Script
cur_frm.add_fetch('customer', 'tax_id', 'vat_number');
customer: Link Field in your document.
tax_id: Source field in the Customer master.
vat_number: Target field in your document.
Add Fields to Your DocType:
A Link Field (address_link) pointing to Address.
A Read-Only Text Field (full_address).
Add a Client Script:
ivendnext.ui.form.on("Sales Invoice", "address_link", function(frm) {
if (frm.doc.address_link) {
frm.call({
method: "ivendnexterp.contacts.doctype.address.address.get_address_display",
args: { "address_dict": frm.doc.address_link },
callback: function(r) {
if (r.message) frm.set_value("full_address", r.message);
}
});
}
});
Test:
Select an address → full_address displays the complete text.
Auto-fetch pre-approved terms from a Contract Template into a Sales Order.
Add Fields:
A Link Field (contract_template) pointing to Contract.
A Read-Only Text Editor (terms).
Configure "Fetch From":
In terms field properties, set:
contract_template.terms
Test:
Select a Contract Template → terms auto-populates.
Standardize Field Names: Use consistent names (e.g., vat_id across all docs).
Document Dependencies: Note which fields rely on linked masters.
Validate Permissions: Ensure users can read the master data.
Fetching data from linked masters eliminates manual entry and ensures consistency across documents. Whether using field matching, add_fetch, or custom scripts, automate workflows to save time and reduce errors.
✅ Field matching works for identical field names.
✅ Use add_fetch to map differently named fields.
✅ Client scripts fetch complex data (e.g., addresses).