Auto select print format with select field in form Frappe

I have a doctype with a select field (option: A and B). this doctype has two print format 1 and 2. I want went i choose option A and save, then click button printview frappe will show print format 2 and select option B frappe show print format 1.

help me please !!! :pray::pray::pray:


Use this in your doctype client script

frm.meta.default_print_format = “Your Print Format Name here”;

you can write condition here or make it dynamic also

thanks for your help sir :clap: