Hello Friends,
I am trying to create a lead custom doctype with an action button. I wrote the js script for the button in the clientside doctype and used frappe.call() tried to fetch out the code which I wrote in serverside script doctype using @frappe.whitelist() but I m not able to fetch it. But if I write the same thing in the py. file it works but that I can’t be done in a live instance…
If you want the script to be run for ‘guest’ accounts(without login), you can set the “Allow Guest” checkbox in the server script.
I am not certain if the decorator @frappe.whitelist() is allowed to be used within the server script.
Thank you for your reply but the issue is I wanted to write frappe. whitelist() code as required… moreover, it’s a production server I can’t change the code so any idea where I can write whitelist code?
That is true but to call the python whitelist function we need to use frappe. call() and for that, we need to give a method which is the location of the python file but the issue is I m writing python code in serverside script doctype from the frontside form so how can I give a method(Location) of that form in the client-side script doctype from frontside form to fetch that python function?
I tried it’s working thank you so much but one more question is if I wanted to send some variables from the javascript to python for the usage… how it can be done in API Script? I tried to give variables in args in a frappe.call() but I m not able to fetch it in my python
Thanks, it worked. But can we add here api call in the server side script(basically importing requests, then make api call) and then set the response like above.