Trigger a function onClick of button over modal in service portal

sruthi22
Tera Contributor

Hi All,

I have two buttons over my modal in service portal 'ok' and 'cancel'. Once clicked on 'Ok' I have to do some changes over other table. And on click of 'cancel' I have to do nothing. I am thinking to keep the first logic inside a function and call it onClick of 'ok' button that is embedded inside modal. Could you please guide me on how to call a function on click of a button that is inside the modal.

I am attaching a small snippet of my modal code:

var Details = {};
                Details.title = 'Hello';
                Details.widget = 'selector';             
                Details.buttons = [{
                    label: 'Ok',
                    primary: true
                },

              { 

                    label: 'Cancel',
                    primary: true

              }];
         Details.widgetInput = {
                    sys_id: 'c.data.sysId'
                };
        spModal.open(Details).then(function(data) {
            console.log('Hi');

});

 

Thanks in Advance,

Sruthi.

1 REPLY 1

Arpitha2
Tera Contributor

Hi sruthi22,

 

Did you get the solution for this? If yes, could you please share the snippet that worked for you.

I do have same requirement to achieve.

 

Thanks in Advance!

 

Regards,

Arpitha G