Hi, I’m trying to dynamically link the published field of web items to disabled field in items but whenever I try to edit the webitem doctype I get it denied.
Also I’m not very sure what would be the right way to do it
1 Like
I did this way and it is working
- Create new Server Script
- Select DocType Event : “Before Send”
- use the following code
website_item_name = frappe.db.get_value(“Website Item”, filters={ ‘item_code’: Item.item_code })
web_item = frappe.get_doc(“Website Item”, website_item_name)
web_item.published=Item.disabled
web_item.save()
frappe.db.commit()
and you will have Website Items that automatically are published or not based on the attribute of the Item doc