Add records in doctype using query

How to add records for doctype by query?

@asd Can you provide answers to the following questions?

  1. Are you trying to add DocTypes using a query? Or just records to an existing DocType?
    1. If it’s the first one, you do not want to do that. Use the Add New DocType function within ERPNext.
    2. If it is the latter, you can use the import feature to add a bunch of records to a DocType.
  2. If you can describe the scenario you are attempting to accomplish, this would really assist in answering your question more directly. It’s just not clear what you’re trying to do.

im trying to add and update DocTypes using a query

checked
but i want coding solution for the issue

Ok, assuming 1) you are using V11 and 2) you mean “records” to a DocType (I think of doctypes as tables), there are three ways that I am aware of for adding and updating records in a DocType:

  1. Updating Existing Records in a DoctType: The “Edit” Action. Which is available after selecting multiple items in a particular doctype list. For example, if you want to update a bunch of “Items” in your Item list, you can select the relevant items, the “Actions” tab will appear and the option to “Edit” the selected items is available. Simply choose the field you want to “update” and then input the value and you’re good to go.
  2. Updating and Adding Records to a DocType: Using the Data Import tool, which allows both the updating of existing records (you would first export the list using the data export tool) and inserting new records.
  3. Updating and Adding Records to a Doctype: If the above two features do not work for you, the next best thing would be to use a mysql management tool and hit the database directly. I wouldn’t recommend this, because you would really need to know the database table structure to not break things.

If you provide a specific example, I might be able to point you in the right direction. My experience is that ERPNext is one of the most flexible interface solutions for mass updating/inserting of data that I’ve seen for this type of application (direct access to the database, not withstanding).

1 Like