Hello,
i want to find a way to make Logs marked as “Don’t delete” be exempt from automatic cleanup. the closest i found for ‘marking’ Logs is by using the like/heart.
so what i wanted to do is that when someone ‘like’ an entree in activity log it get saved into a custom doctype i made, ’ Archived Logs’
the method i tried is to make a scheduled server script that would execute daily to see entrees in activity log which have (i will add it below)
if anyone know how to implement a server or if an alternative way exist to either exempt the logs or a way to bookmark them away from auto-deletion, please help
def archive_favorited_logs():
# Get all liked Activity Log document names from the Like table
liked_logs = frappe.get_all(
“Like”,
filters={“ref_doctype”: “Activity Log”},
fields=[“ref_name”]
)
for like in liked_logs:
log_name = like.ref_name
# Fetch the log details
log = frappe.get_doc("Activity Log", log_name)
# Checking if it is already there
if not frappe.db.exists("Archived Logs", {"original_log_id": log.name}):
new_log = frappe.get_doc({
"doctype": "Archived Logs",
"subject": log.subject,
"log_type": log.log_type,
"original_log_id": log.name,
"created_on": log.creation
})
new_log.insert(ignore_permissions=True)
i tried this method and other methods to store them in a seperate place or exempt them from deletion but to no avail