How do you set the OnClick values for buttons created using spModal

siakam
Kilo Expert

I am currently building a Modal that pops up when a user saves a record on the Service Portal. I have been using spModal.open to generate this modal. I want the button generated with the Modal to call a specific function when it is clicked. Is there a way to do this?

For clarity, I am referring to this line in the spModal.open function.
buttons: [
{label:'OK', primary: true}
]

5 REPLIES 5

Sebastian24
Tera Contributor

Hello,

 

1. Create buttons and assign some property like "primary".

2. Add the "actionButton" to the function.

3. Use the actionButton and the properties of the buttons for your logic.

 

You can copy the code from your out of the box "my-requests-v2" sp_widget.

 

 

Kind regards,

Sebastian

 

 

Sebastian24_1-1743030644490.png