I want to send SMS on after_save event of WebForm and I have to send it without the user logged in. The WebForm is publically accessible and user does not have to be logged-in to submit the form.
My problem is erpnext is giving the following error
File "apps/frappe/frappe/app.py", line 66, in application
response = frappe.handler.handle()
File "apps/frappe/frappe/handler.py", line 38, in handle
data = execute_cmd(cmd)
File "apps/frappe/frappe/handler.py", line 73, in execute_cmd
is_whitelisted(method)
File "apps/frappe/frappe/__init__.py", line 750, in is_whitelisted
throw(_("Not permitted"), PermissionError)
File "apps/frappe/frappe/__init__.py", line 504, in throw
msgprint(
File "apps/frappe/frappe/__init__.py", line 479, in msgprint
_raise_exception()
File "apps/frappe/frappe/__init__.py", line 434, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.PermissionError: Not permitted
this is permission error, and it does not come when this form is submitted after login.
Is there any way I could send SMS on WebForm submission without logging in to erpnext?
my code to send the SMS is below
frappe.web_form.after_save = () => {
frappe.call({
method: "frappe.core.doctype.sms_settings.sms_settings.send_sms",
args: {
receiver_list: [number],
msg: message,
},
callback: function(r) {
if (r.exc) {
msgprint(r.exc);
return;
}
}
});
}