I am on frappe 13.x.x-develop developing my custom app. No erpnext!
I am trying to call frappe.db.get_doc to retrieve a custom document info in a custom script. I am using the following code:
var upgrade_os;
frappe.db.get_doc(‘Operating Systems’, null, {os_srs_supported:1, os_agent_supported:1})
.then( upgrade_os => {
console.log('better you upgrade to : ’ + upgrade_os.name)
});
I am getting the following error in the console:
(INTERNAL SERVER ERROR)
request.js:274 Unable to handle failed response
request.js:275 SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse () at Object.frappe.request.report_error (request.js:409) at 500 (request.js:188) at Object. (request.js:268) at i (jquery.min.js:2) at Object.fireWith [as rejectWith] (jquery.min.js:2) at z (jquery.min.js:4) at XMLHttpRequest. (jquery.min.js:4)
||(anonymous)|@|desk.min.js?ver=1600057565.0:1|
i@jquery.min.js:2
fireWith@jquery.min.js:2
z@jquery.min.js:4
(anonymous)@jquery.min.js:4
load (async)
send@jquery.min.js:4
ajax@jquery.min.js:4
frappe.request.call@desk.min.js?ver=1600057565.0:1
frappe.call@desk.min.js?ver=1600057565.0:1
(anonymous)@desk.min.js?ver=1600057565.0:1
get_doc@desk.min.js?ver=1600057565.0:1
eval@VM1308:235
Promise.then (async)
eval@VM1308:217
i@desk.min.js?ver=1600057565.0:1
dispatch@jquery.min.js:3
r.handle@jquery.min.js:3
line 235 referenced in eval@VM1308:235 corresponds to the frappe.db.get_doc function call mentioned earlier.
I noticed that calling the function with the field name set (not null), everything works fine. In addition, if I settle with only one field the in the filters list, things work fine as well. Once I start having the comma-delimited list of filters, the exception is raised.
I searched the forum and reviewed the documentation with no luck.
Any clue what am I doing wrong or where to look for hints?!
Thanks