Custom script filter

Hey, I try to write a custom script in web forms to make only records in a doctype with a check mark show. I got it to work at the desk site when creating a new record, but I do not get it to work in the custom script part of my web form.

Is there someone who has a code that can filter fields in web forms?

Thanks in advance!


I think the only way to filtering data is using get_context and get_list_context in your file

def get_list_context(context):

	context.filters ={"enabled": 0}
	return context

Replace “enabled” with your field.
Hope this helps.

1 Like

Hey, thanks for your quick response. Can you maybe elaborate more on how to make this happen? And are there any other scripts I have to add in the web form script added to the one you sent?

I am kinda lost after I was able to code anything into the desk side, but in the web form nothing is working.


Code suggested is python code. You need to modify .py file for your webform using some code editor.
You will find this .py file in your doctype directory (if your webform has checked “is_standard” field)

Script in webform doctype just admits javascript code.
Hope this helps.

Thanks for your explanation. I figured it out in the way you described. It is disappointing that I first have to change the form to “is_standard” with the implication of not being able to edit it anymore in the desk view.

Hopefully, there will be an option for this in the future that is accessible directly via the web form since I think is important to have.