Triggering a function when a button is clicked in UI action

labandar
Tera Contributor

Hello ServiceNow Dev,

I have created a custom Dialogue Box for Change module when the UI Action Request Approval is triggered. As show in the picture below. I need to call a function invokeRiskAssessment() which is in the same UI Action when the button 'Calculate Risk' clicked.

How to identify that the Calculate Risk button has been clicked in the UI action?

The dialogue box: 

labandar_0-1733910552252.png


The code used to create this popup in UI Action: 

var riskAssessmentUIPage = 'stla_change_request_risk_calculation'; //This is the UI Page created for the dialgue box
    var riskAssessmentPopup =  new GlideModal(riskAssessmentUIPage,true);
        riskAssessmentPopup.setTitle('Risk Evaluation');
        riskAssessmentPopup.setPreference("onRiskCalculate","yes");
        riskAssessmentPopup.render();
        window.g_parentDialog = riskAssessmentPopup;
2 REPLIES 2

Mark Manders
Mega Patron

Check this: https://www.servicenow.com/community/developer-forum/call-a-specific-function-of-ui-action-from-ui-p...

 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Hello @Mark Manders , this just shows how to add an option into the form but calling a function of UI Action into UI Page client script is not specified in this.