Dialogue Box Depends On condition and Fetch Datas

Hello Guys

I added a custom button and while clicking that a dialogue box displayed. after submitting data on the dialogue box the doc is updated and saved.

But I need to add a display depending on condition on the dialogue box fields and fetch the data automatically while selecting link fields.

This is my code but it is not work

frm.add_custom_button("Schesule Interview", () => {

                let d = new frappe.ui.Dialog({
                                    title: 'Enter Meeting Updates',
                                    fields: [
                                         
                                         {
                                             label: 'Interview Type',
                                             fieldname: 'interview_type',
                                            fieldtype: 'Select',
                                            options :'Direct \n Google Meet'
                                           
                                         },
                                         {
                                             label: 'Location',
                                             fieldname: 'location',
                                            fieldtype: 'Link',
                                             options :'Venue',
                                    
                                     // 'depends_on': "eval:doc.interview_type===\"Direct\"",

                                           
                                         },
                                         {
                                             label: 'Google Meet Link',
                                             fieldname: 'meet_link',
                                            fieldtype: 'Data',
                                            //fetch_from:'location.address'
                                           
                                         }
       
       
                                    ],
                                    primary_action_label: 'Submit',
                                    primary_action(values) 
                                    {
                                        console.log(values);
                                        
                                        // frm.set_value("meet_updates",values.requirements)
                                        //frm.set_value("proposal",values.proposal)
                                     
                                        //var child = cur_frm.add_child("summary_of_meeting");
                                     
                                       //frappe.model.set_value(child.doctype, child.name, "contact_on",values.contact_on);
                                       //frappe.model.set_value(child.doctype, child.name, "clients_requirement",values.requirements);
                                       //frappe.model.set_value(child.doctype, child.name, "proposal",values.proposal);
                                       //frappe.model.set_value(child.doctype, child.name, "summary",values.summary);
                                       // cur_frm.refresh_field("summary_of_meeting");
                                        
                                       
                                        //cur_frm.save();
                                      
                                        d.hide();
                               
                                    }
                                    
                                    
                                    
                                });
                                d.show();
                })
                
                frm.change_custom_button_type('Schesule Interview', null, 'success');

Please help me with this

Thanks

1 Like

Try remove spaces in options for interview_type field
Like this,

options :'Direct\nGoogle Meet'

And depends_on like this,

‘depends_on’: "eval:doc.interview_type==“Direct”

Thanks, @Shankar_V…Its working.

can you please help me with how to fetch data to the dialogue box?

@jinsy Can’t understand what u try to say.
Fetch values from dialog and fill it in doctype or child doc ?

@Shankar_V The fetch values from the dialog box and fill them in the doctype.

cur_frm.set_value("field_in_doctype", values.fieldname_from_dialog);
cur_frm.refresh();

Ok, thanks @Shankar_V. I will try

@Shankar_V The field values from the dialogue box is blank and it doesn’t return in the response message using primary action.