Try ERPNext Buy Support Partners Foundation

Changes made in via frappe client calls not saving

I added a ‘number_of_members’ to the Customer DocType via customization.

In my application I have tried several ways to update the value. However the value never updates in the webpage. I feel like I’m missing some sort of save or update or commit step.

For example I have tried:

  • frappe.client.set_value('Customer', '00042', 'number_of_members', 8887)
  • frappe.set_value('Customer', '00042', 'number_of_members', 8887)
  • frappe.db.set_value('Customer', '00042', 'number_of_members', 8887)
  • and also
customer = frappe.get_doc('Customer', '00042')
customer.number_of_members = 8887
customer.save()

In each case I can do something like frappe.get_value, or frappe.get_doc and it shows the value is set to 8887. However it never updates in the web side. This is what makes me think I’m updating some sort of cache or database transaction and I need some way to save it, but have not had any luck.

I am mostly testing this via bench console if that has any bearing on it, but I’ve tried a couple of the methods in my application code as well.

Relevant documentation:

is the value getting displayed after refreshing the page?

check using sql to see if the data is updated in the actual database

I tested again and checked the database, and nothing is updating there. I’ve attached a screen shots and a recording at asciinema

Thanks for any ideas!

You’re missing frappe.db.commit()

1 Like

Thank you!