Some useful Frappe functions

Here we list some useful Frappe function, which can be used in API and other programming

 · 1 min read

Programming Code Abstract Screen Software Developer Stock Photo 230705539 |  Shutterstock

Get the stock value through API

stock=frappe.db.sql(f"""SELECT actual_qty FROM `tabBin` WHERE item_code='Pen' ORDER BY modified DESC LIMIT 1;""")


Get the username of the current session


Get fullname of the user of current session


Get system settings ( Get single doc )

stock=frappe.get_doc('System Settings')

settings = frappe.get_doc('System Settings')

stock = settings.app_name

Get an item from a document ( Permission DONOT apply )

item = frappe.get_doc('Item', 'Pen')


Get an item from a document ( Permission Apply )

stock = frappe.db.get_list('Item')


Insert data through API

doc = frappe.new_doc('image-test')

doc.title = frappe.form_dict.title

doc.name1 = frappe.form_dict.name1


frappe.response['message'] = "Insert completed successfully"

( insert values through form-data )

Get all attachments from a form side bar ( on chrome console )


Team ERPGulf

The team behind ERPGulf blogs here, expresses their thoughts, shares the experience, often show the frustrations. Contact us on

No comments yet

No comments yet. Start a new discussion.

Add Comment