Thank you @avc
AFAIK, with createDocumentResource
you can’t define which fields you want (fields: ['description', 'status', 'date', 'name']
) it, so you get all the fields:
{
"doctype": "ToDo",
"name": "0489l150rq",
"doc": {
"name": "0489l150rq",
"owner": "Administrator",
"creation": "2025-01-14 10:39:57.545285",
"modified": "2025-01-14 10:39:57.545285",
"modified_by": "Administrator",
"docstatus": 0,
"idx": 0,
"status": "Open",
"priority": "Medium",
"color": null,
"date": "2025-01-14",
"allocated_to": null,
"description": "test1",
"reference_type": null,
"reference_name": null,
"role": null,
"assigned_by": null,
"assigned_by_full_name": null,
"sender": null,
"assignment_rule": null,
"doctype": "ToDo"
},
"originalDoc": {
"name": "0489l150rq",
"owner": "Administrator",
"creation": "2025-01-14 10:39:57.545285",
"modified": "2025-01-14 10:39:57.545285",
"modified_by": "Administrator",
"docstatus": 0,
"idx": 0,
"status": "Open",
"priority": "Medium",
"color": null,
"date": "2025-01-14",
"allocated_to": null,
"description": "test1",
"reference_type": null,
"reference_name": null,
"role": null,
"assigned_by": null,
"assigned_by_full_name": null,
"sender": null,
"assignment_rule": null,
"doctype": "ToDo"
},
"isDirty": false,
"auto": true,
"get": {
"url": "frappe.client.get",
"data": {
"name": "0489l150rq",
"owner": "Administrator",
"creation": "2025-01-14 10:39:57.545285",
"modified": "2025-01-14 10:39:57.545285",
"modified_by": "Administrator",
"docstatus": 0,
"idx": 0,
"status": "Open",
"priority": "Medium",
"color": null,
"date": "2025-01-14",
"allocated_to": null,
"description": "test1",
"reference_type": null,
"reference_name": null,
"role": null,
"assigned_by": null,
"assigned_by_full_name": null,
"sender": null,
"assignment_rule": null,
"doctype": "ToDo"
},
"previousData": null,
"loading": false,
"fetched": true,
"error": null,
"promise": {},
"params": {
"doctype": "ToDo",
"name": "0489l150rq"
}
},
"setValue": {
"url": "frappe.client.set_value",
"data": null,
"previousData": null,
"loading": false,
"fetched": false,
"error": null,
"promise": null,
"params": null
},
"setValueDebounced": {
"url": "frappe.client.set_value",
"data": null,
"previousData": null,
"loading": false,
"fetched": false,
"error": null,
"promise": null,
"params": null
},
"save": {
"url": "frappe.client.set_value",
"data": null,
"previousData": null,
"loading": false,
"fetched": false,
"error": null,
"promise": null,
"params": null
},
"delete": {
"url": "frappe.client.delete",
"data": null,
"previousData": null,
"loading": false,
"fetched": false,
"error": null,
"promise": null,
"params": null
}
}
So far, I don’t get what’s the use case of it.
createListResource
(list of one) works and also use get_list. You need to import { useRoute } from 'vue-router';
I really wonder why 3 different and so identical functions, 1 doesn’t implement fields, another need url and params, and this last one seems to work for all cases.
Hmmm, createResource
might be just in case to want to fetch external public data, which is super niche.
createDocumentResource for:
- edit (setValue.submit({ status: ‘Closed’ }))
- whitelistedMethods