Setting Default Values and Multi-Field Document Titles

Setting Default Values and Multi-Field Document Titles

Introduction

Efficient data entry and clear document identification are critical for productivity in iVendNext. This guide covers two powerful features:


  1. Setting default values to automate repetitive inputs.

  2. Creating multi-field document titles for better readability and searchability.




Part 1: Setting Default Values

1.1 Why Use Default Values?

  • Saves time: Auto-fills frequently used data (e.g., default country, tax codes).

  • Reduces errors: Ensures consistency for mandatory fields.

  • Supports conditional logic: Dynamic defaults based on other fields.


1.2 How to Configure Default Values

Step 1: Access Field Properties

  1. Go to Customize Form → Select the target DocType (e.g., "Sales Invoice").

  2. Locate the field → Expand its properties.


Step 2: Define the Default

  • Static Value: Enter directly in Default Value (e.g., "USD" for Currency).

  • Dynamic Reference: Use {field_name} syntax (e.g., {today} for current date).


Example:


  • Field: Posting Date

  • Default Value: {today}



Advanced: Conditional Defaults

Use Custom Scripts to set defaults based on dependencies:


# Set "Territory" to "North" if "Region" is "EMEA"

if doc.region == "EMEA":

    doc.territory = "North"




Part 2: Multi-Field Document Titles

2.1 Benefits of Multi-Field Titles

  • Clarity: Combines key details (e.g., {customer_name} - {invoice_date}).

  • Searchability: Simplifies filtering in list views.


2.2 How to Configure

Step 1: Identify Title Fields

Ensure referenced fields exist (e.g., customer_name, invoice_date).


Step 2: Create a Consolidated Field

  1. Add a Read Only or HTML field (e.g., "Consolidated Title").

  2. In Options, enter the template:


{customer_name} - Invoice #{name} ({posting_date})  


Note:


  • Avoid Data field types (they don’t support dynamic updates).

  • Use {name} for the document’s auto-generated ID.



Step 3: Set as Document Title

  1. In Customize Form, go to View Settings.

  2. Under Title Field, select the consolidated field.


Output Example:


"Acme Corp - Invoice #INV-2024-001 (2024-06-20)"




3. Best Practices & Troubleshooting

3.1 For Default Values

Scenario

Recommendation

Date-dependent defaults

Use {today} or frappe.utils.nowdate().

User-specific defaults

Reference frappe.session.user.

Mandatory fields

Combine with Is Mandatory flag.


3.2 For Multi-Field Titles

  • Test Formatting: Ensure long fields don’t break layouts.

  • Avoid Circular References: E.g., {title} in a title field.

  • Use HTML for Rich Text: Add icons/colors via <span> tags.




Conclusion

  • Default Values streamline data entry and enforce consistency.

  • Multi-Field Titles enhance document identification and reporting.




    • Related Articles

    • Customizing Document Titles for Better Clarity

      Overview Document titles in iVendNext help identify and manage transactions. Default titles like “QUO-0001” lack context, but adding customer names, dates, or codes makes them clearer and more useful. This article shows how to customize them ...
    • Understanding Field Types

      Overview Fields in iVendNext shape how data is entered, shown, and used across forms and documents. Choosing the right type—whether for sales, inventory, or customer records—boosts accuracy and efficiency. This guide covers field types, their uses, ...
    • Understanding Multi-Currency Accounting

      Overview Global businesses often deal with multiple currencies. iVendNext makes it easy to manage foreign transactions, exchange rates, and reporting. This article covers the key steps to handle multi-currency accounting accurately and efficiently. ...
    • Setting Up Your Company

      Overview Setting up your company is the first key step to ensure smooth financial and operational workflows. A proper setup supports accurate accounting, inventory control, and transactions. This article walks you through each step—from basic info to ...
    • Setting Up Discount Accounting

      Overview Discount accounting in iVendNext helps track discounts on sales and purchases by posting them to a separate ledger. This article walks you through the setup for clear, accurate financial reporting. To use discount accounting in iVendNext, ...