Logo
  • Version
      Version 13 Version 14
  • Docs
  • Reviews
  • Tutorial
  • GitHub
  • Learn
    • Getting Started
      • Introduction
      • Prerequisites
      • Installation
    • Tutorial
      • Frappe Framework Tutorial
      • Install and Setup Bench
      • Create an App
      • Create a Site
      • Create a DocType
      • DocType Features
      • Controller Methods
      • Types of DocType
      • Form Scripts
      • Web View Pages
      • What's Next?
    • Guides
      • Guides
    • Guides - Basics
      • Frappe Apps
      • Contribute Translations
      • Frappe Ajax Call
      • How to Enable Backup Encryption
      • Sites
      • Translations
    • Guides - App Development
      • Executing Code On Doctype Events
      • How To Improve A Standard Control
      • Running Background Jobs
      • Adding Custom Button To Form
      • Trigger Event On Deletion Of Grid Row
      • Dialogs Types
      • Overriding Link Query By Custom Script
      • Set up a new Connected App
      • Custom Module Icon
      • Insert A Document Via Api
      • How To Create Custom Fields During App Installation
      • Using Html Templates In Javascript
      • How to Enable Developer Mode in Frappe
      • Fetch a Field Value from a Document into a Transaction
      • Adding Module Icons On Desktop
      • Single Type Doctype
      • Prerequisites
      • Adding Social Login Provider
      • Exporting Customizations to your App
    • Guides - Deployment
      • Packages
      • Email Notifications For Failed Background Jobs
      • How To Migrate Doctype Changes To Production
      • Migrations
      • How To Enable Social Logins
    • Guides - Reports and Printing
      • Getting Information From Another Document In Print Format
      • Where Do I Find Standard Print Formats
      • How To Make Query Report
      • Report Print Formats
      • Script Report
    • Guides - Portal Development
      • Pages
      • Ordering
      • Adding Pages
      • Table of Contents
      • Dynamic Pages
      • Portal Roles
      • Customizing Web Forms
      • Generators
      • Redirects
    • Guides - Data
      • Using the Data Migration Tool
      • Import Large Csv File
    • Guides - Integration
      • Google GSuite
      • Token based authentication
      • OpenID Connect and Frappe social login
      • Webhooks
      • Social Login Key
      • Google Calendar Integration
      • How to setup OAuth 2?
      • Token based authentication
    • Integration - REST API
      • Introduction
      • Simple Authentication
      • Token Based Authentication
      • OAuth 2
      • Listing documents
      • Manipulating DocTypes
    • Guides - Database Settings
      • Setup read operations from slave/secondary mysql system
      • Postgres Database Setup
    • Guides - Automated Testing
      • Automated Testing
      • Unit Testing
      • UI Integration Testing
      • UI Testing with Frappe API
    • Guides - Desk
      • Desk Customization
      • Formatter For Link Fields
      • Making Charts
    • Basics
      • What is Frappe Framework?
      • Why Frappe Framework?
      • Architecture
      • Directory structure
      • Apps
      • Sites
      • Understanding DocTypes
      • Developer API
      • Users and Permissions
      • Asset Bundling
      • Static Assets
      • Configuration
    • Doctypes
      • Docstatus
      • Module
      • Field Types
      • DocField
      • Naming
      • Controllers
      • Form & View Settings
      • Child / Table DocType
      • Single DocType
      • Actions and Links
      • Customizing DocTypes
    • Desk
      • Desk
      • Reports
      • Printing
      • Attachments
      • Scripting
    • Desk - Reports
      • Script Report
      • Query Report
      • Report Builder
    • Desk - Scripting
      • Client Script
      • System Console
      • Server Script
      • Script API
    • Portal
      • Discussions
      • Portal Pages
      • Web Forms
      • Blog Post
    • Python API
      • Background Jobs
      • Document API
      • Database API
      • Jinja API
      • Request Lifecycle
      • Language Resolution
      • Utility Functions
      • Responses
      • Search
      • Hooks
      • REST API
      • FullTextSearch API
      • Dialog API
      • Query Builder
    • JS API
      • Form Scripts
      • Controls
      • List
      • Page API
      • Tree
      • Common Utilities API
      • Dialog API
      • Chart API
      • Scanner API
      • Server Calls (AJAX)
      • Logging
      • Form Tours
    • Integration
      • RazorPay
      • Google Drive
      • Setting up LDAP
    • Videos
      • Video Tutorials for Frappe Framework
    • Bench
      • Bench
      • Bench Commands
      • Frappe Commands
      • Bench - Extending the CLI
    • Bench - Reference
      • Commands Reference
      • bench new-site
      • bench drop-site
      • bench migrate
      • bench backup
      • bench reinstall
      • bench list-apps
      • bench uninstall-app
      • bench show-config
      • bench set-config
      • bench restore
      • bench partial-restore
      • bench version
      • bench transform-database
      • bench trim-database
      • bench trim-tables
    • Bench - Resources
      • Background Services
      • Bench Commands Cheatsheet
      • Bench Procfile
    • Bench - Guides
      • Adding Custom Domains to your Site
      • Configuring HTTPS
      • Diagnosing The Scheduler
      • Using Let's Encrypt to setup HTTPS
      • Manual Setup
      • Setting Limits for your Site
      • Setup Multitenancy
      • Setup Production
    • Deployment
      • Database Migrations
      • Production Setup
      • Rate Limiting
    • Writing Tests
      • Testing
      • UI Testing
    • Help
      • Debugging
      • How to contribute
      • Profiling and Monitoring
      • Translations
      • Logging
    Edit Sidebar
    View Sidebar
    Add Group
  • Getting Started
    • Introduction
    • Prerequisites
    • Installation
  • Tutorial
    • Frappe Framework Tutorial
    • Install and Setup Bench
    • Create an App
    • Create a Site
    • Create a DocType
    • DocType Features
    • Controller Methods
    • Types of DocType
    • Form Scripts
    • Web View Pages
    • What's Next?
  • Guides
    • Guides
  • Guides - Basics
    • Frappe Apps
    • Contribute Translations
    • Frappe Ajax Call
    • How to Enable Backup Encryption
    • Sites
    • Translations
  • Guides - App Development
    • Executing Code On Doctype Events
    • How To Improve A Standard Control
    • Running Background Jobs
    • Adding Custom Button To Form
    • Trigger Event On Deletion Of Grid Row
    • Dialogs Types
    • Overriding Link Query By Custom Script
    • Set up a new Connected App
    • Custom Module Icon
    • Insert A Document Via Api
    • How To Create Custom Fields During App Installation
    • Using Html Templates In Javascript
    • How to Enable Developer Mode in Frappe
    • Fetch a Field Value from a Document into a Transaction
    • Adding Module Icons On Desktop
    • Single Type Doctype
    • Prerequisites
    • Adding Social Login Provider
    • Exporting Customizations to your App
  • Guides - Deployment
    • Packages
    • Email Notifications For Failed Background Jobs
    • How To Migrate Doctype Changes To Production
    • Migrations
    • How To Enable Social Logins
  • Guides - Reports and Printing
    • Getting Information From Another Document In Print Format
    • Where Do I Find Standard Print Formats
    • How To Make Query Report
    • Report Print Formats
    • Script Report
  • Guides - Portal Development
    • Pages
    • Ordering
    • Adding Pages
    • Table of Contents
    • Dynamic Pages
    • Portal Roles
    • Customizing Web Forms
    • Generators
    • Redirects
  • Guides - Data
    • Using the Data Migration Tool
    • Import Large Csv File
  • Guides - Integration
    • Google GSuite
    • Token based authentication
    • OpenID Connect and Frappe social login
    • Webhooks
    • Social Login Key
    • Google Calendar Integration
    • How to setup OAuth 2?
    • Token based authentication
  • Integration - REST API
    • Introduction
    • Simple Authentication
    • Token Based Authentication
    • OAuth 2
    • Listing documents
    • Manipulating DocTypes
  • Guides - Database Settings
    • Setup read operations from slave/secondary mysql system
    • Postgres Database Setup
  • Guides - Automated Testing
    • Automated Testing
    • Unit Testing
    • UI Integration Testing
    • UI Testing with Frappe API
  • Guides - Desk
    • Desk Customization
    • Formatter For Link Fields
    • Making Charts
  • Basics
    • What is Frappe Framework?
    • Why Frappe Framework?
    • Architecture
    • Directory structure
    • Apps
    • Sites
    • Understanding DocTypes
    • Developer API
    • Users and Permissions
    • Asset Bundling
    • Static Assets
    • Configuration
  • Doctypes
    • Docstatus
    • Module
    • Field Types
    • DocField
    • Naming
    • Controllers
    • Form & View Settings
    • Child / Table DocType
    • Single DocType
    • Actions and Links
    • Customizing DocTypes
  • Desk
    • Desk
    • Reports
    • Printing
    • Attachments
    • Scripting
  • Desk - Reports
    • Script Report
    • Query Report
    • Report Builder
  • Desk - Scripting
    • Client Script
    • System Console
    • Server Script
    • Script API
  • Portal
    • Discussions
    • Portal Pages
    • Web Forms
    • Blog Post
  • Python API
    • Background Jobs
    • Document API
    • Database API
    • Jinja API
    • Request Lifecycle
    • Language Resolution
    • Utility Functions
    • Responses
    • Search
    • Hooks
    • REST API
    • FullTextSearch API
    • Dialog API
    • Query Builder
  • JS API
    • Form Scripts
    • Controls
    • List
    • Page API
    • Tree
    • Common Utilities API
    • Dialog API
    • Chart API
    • Scanner API
    • Server Calls (AJAX)
    • Logging
    • Form Tours
  • Integration
    • RazorPay
    • Google Drive
    • Setting up LDAP
  • Videos
    • Video Tutorials for Frappe Framework
  • Bench
    • Bench
    • Bench Commands
    • Frappe Commands
    • Bench - Extending the CLI
  • Bench - Reference
    • Commands Reference
    • bench new-site
    • bench drop-site
    • bench migrate
    • bench backup
    • bench reinstall
    • bench list-apps
    • bench uninstall-app
    • bench show-config
    • bench set-config
    • bench restore
    • bench partial-restore
    • bench version
    • bench transform-database
    • bench trim-database
    • bench trim-tables
  • Bench - Resources
    • Background Services
    • Bench Commands Cheatsheet
    • Bench Procfile
  • Bench - Guides
    • Adding Custom Domains to your Site
    • Configuring HTTPS
    • Diagnosing The Scheduler
    • Using Let's Encrypt to setup HTTPS
    • Manual Setup
    • Setting Limits for your Site
    • Setup Multitenancy
    • Setup Production
  • Deployment
    • Database Migrations
    • Production Setup
    • Rate Limiting
  • Writing Tests
    • Testing
    • UI Testing
  • Help
    • Debugging
    • How to contribute
    • Profiling and Monitoring
    • Translations
    • Logging
Edit Sidebar
View Sidebar
Add Group

Fetch a Field Value from a Document into a Transaction

Edit Revisions

Let's say, there is a custom field "GSTIN" in Supplier, which should be fetched in Purchase Order. It is possible to pull this data into any form that links to a Supplier document. In this example, the Purchase Order doctype requires a Supplier specified in the supplier field.

Scenario I: You want to keep this field updated

In this scenario, the custom field will be updated automatically based on the value in Supplier when you save the Purchase Order and will be re-updated everytime you save the Purchase Order. Since this field needs to be updated automatically, it overwrites user input. If you want to allow user input, refer to Scenario II.

Steps:

  1. Create a Custom Field GSTIN for Supplier document with Field Type as Data.

  2. Create another Custom Field GSTIN for Purchase Order document, but in this case with Field Type as Read Only or check Read Only checkbox. Set Fetch From as supplier.gstin.

  1. Go to the user menu and click "Reload".

  2. Now, on selection of Supplier in a new Purchase Order, GSTIN will be fetched automatically from the selected Supplier.

Scenario II: You want to allow user input if value not found

In this scenario, the value is fetched from the Supplier the first time the Purchase Order is created. If the value is not found in Supplier, you can enter it manually. The value will only be fetched on saving Purchase Order if the field is empty.

Steps:

  1. Create a Custom Field GSTIN for Supplier document with Field Type as Data.

  1. Create another Custom Field GSTIN for Purchase Order document with Field Type as Data. Set Fetch From as supplier.vat_number and tick the checkbox titled Fetch If Empty.

  1. Go to the user menu and click "Reload".

  2. Now, on selection of Supplier in a new Purchase Order, GSTIN will be fetched automatically from the selected Supplier. If GSTIN is not found in supplier, you can enter it manually.

Fetch a Field Value from a Document into a Transaction
peter_g edited 5 months ago

Let's say, there is a custom field "GSTIN" in Supplier, which should be fetched in Purchase Order.

Scenario I: You want to keep this field updated

In this scenario, the custom field will be updated automatically based on the value in Supplier when you save the Purchase Order and will be re-updated everytime you save the Purchase Order. Since this field needs to be updated automatically, it overwrites user input. If you want to allow user input, refer to Scenario II.

Steps:

  1. Create a Custom Field GSTIN for Supplier document with Field Type as Data.

  2. Create another Custom Field GSTIN for Purchase Order document, but in this case with Field Type as Read Only or check Read Only checkbox. Set Fetch From as supplier.gstin.

  1. Go to the user menu and click "Reload".

  2. Now, on selection of Supplier in a new Purchase Order, GSTIN will be fetched automatically from the selected Supplier.

Scenario II: You want to allow user input if value not found

In this scenario, the value is fetched from the Supplier the first time the Purchase Order is created. If the value is not found in Supplier, you can enter it manually. The value will only be fetched on saving Purchase Order if the field is empty.

Steps:

  1. Create a Custom Field GSTIN for Supplier document with Field Type as Data.

  1. Create another Custom Field GSTIN for Purchase Order document with Field Type as Data. Set Fetch From as supplier.vat_number and tick the checkbox titled Fetch If Empty.

  1. Go to the user menu and click "Reload".

  2. Now, on selection of Supplier in a new Purchase Order, GSTIN will be fetched automatically from the selected Supplier. If GSTIN is not found in supplier, you can enter it manually.

Heading 2 Heading 3 Heading 4 Heading 5 Heading 6
Set Link
Insert Table Add Column Before Add Column After Delete Column Add Row Before Add Row After Delete Row Toggle Header Column Toggle Header Row Toggle Header Cell Delete Table
Discard
Save
Toggle Dropdown
Save Draft
Title

Previous Page

Left

Next Page

Right

On this page
  • Scenario I: You want to keep this field updated
  • Steps:
  • Scenario II: You want to allow user input if value not found
  • Steps: