I am trying to pass my filter arguments in report javascript file to server python file but i am not able to do that

	 frappe.call({
	        type : 'POST',
			method:'example_json',
			
			args: {
			    filters: {
		        posting_date : "2021-08-01"
			}
		},

i am trying since long to pass parameter but it is not work…waiting for the help!

def get_test1_api(posting_date):
frappe.msgprint(posting_date)
return frappe.db.sql(“”“SELECT name FROM tabSales Invoice WHERE customer_gstin=‘000000000000’”“”)

waiting??

Hi @Rehan_Ansari

can you share .py and .js file here

js file

python file

You can pass arg like

args: {company: report.get_values().company,`

thank you for reply…still getting same error

like comany is not defined

replce the args as per your syntax but getting same error

python file js file
same error

any update?

screenshot py file contains example_json method, please


In example_json file there is a method called get_test1_api()

seems this PR may help you understand api call to server script, it is only for develop branch at the moment.

i can’t understand ?

Hello @Rehan_Ansari,
If you can share more details what you are trying to achieve then someone can give you pointer for that.

Also if you can share code instead of screenshot will help us to understand what you trying to achieve.

this is js file:

frappe.call({
type : ‘POST’,
method:‘example_json’,

		args: {
		    filters: {
	        posting_date : "2021-08-01"
		}
	},

i am trying to pass posting_date to python server but it showing error that posting_date not defined

my python code:

def get_test1_api(posting_date):
frappe.msgprint(posting_date)
return frappe.db.sql(“”“SELECT name FROM tabSales Invoice WHERE customer_gstin=‘000000000000’”“”)

I have added the code that works for me:
Client Script

frappe.call({
	        method: "api_server_script_method_name",
	        args:{
	            'posting_date': frm.doc.date
	        },
	        callback:function(r){
	            
	        }
	    });

Server Script API:

Screenshot 2024-01-09 at 1.25.08 PM