Capturing and Updating Sales Person and Location Data on Lead and Customer Pages

Hello ERPNext community,

I’m working on a customization and need some guidance on how to properly implement the following requirements:

  1. Capturing Sales Person and Location Data:
  • On both the Lead and Customer pages, I want to capture two specific pieces of data:
    • The parent sales person from the Sales Person doctype.
    • The location of the sales person from the Employee doctype.
  • These fields should be automatically populated when the Lead or Customer is created, based on the document owner (i.e., the user who created or owns the document).
  1. Updating the Captured Data When Document Owner Changes:
  • Additionally, if the document owner changes (e.g., the owner field of the Lead or Customer doctype is updated), the system should automatically update the captured sales person and location data to reflect the new owner’s information.
  • I’m considering using server-side scripting to handle these updates, but I’m unsure of the best way to implement this efficiently.

Kindly help me with this as it is really important to implement this.