Frappe Cloud Support Partners Foundation

Frappe Client - Set value in database


I want to use Frappe Client (because I need to modify values from another server) to update a value in the database. The field which needs to be updated is a field generated and updated by a workflow. This field is named “production_status”. I earlier achieved this with a python file using the following command: frappe.db.set_value(‘Item’, item_code, “production_status”, TO_BE_ASSESSED).

Frappe Client does only contain frappe.client.set_value which will not work because the field is read only (so it needs to be modified in the database directly). So, I added my own function to Frappe Client to achieve this:

def set_value_db(self, doctype, docname, fieldname, value):
	return self.post_request({
		'cmd': 'frappe.db.set_value',
		'doctype': doctype,
		'name': docname,
		'fieldname': fieldname,
		'value': value

Code in my script on the client server:
conn.set_value_db(ITEM_DOCTYPE, item_code, “production_status”, TO_BE_ASSESSED)

This gives the following error:

I also tried frappe.db.set but without success. I also tried to use the same argument naming as defined in (to prevent naming conversion mismatch) but this also will not solve the problem.

Someone got an idea of how to use frappe.db.set_value from Frappe Client. Or a way to trigger an action on the Item doctype to go to the next workflow state? Or is there a way to make an own server-side function that can be called from Frappe Client (so I can perform a sql query on the server-side)?

Thank you for your help!