Trigger UI Builder Page modal using Client Script[sys_ux_client_script]

pgvaishnav
Tera Contributor

Hi Team,
I have a quick question, I have created three Modal on the page on click of a button first modal will appear which has choice field based on the choice either modal two or three should popup, 
my current approach is i have created a client state parameter which stores the value of choice and trying to popup the modal based on value through the client script but unable to do it.
is there any other way through which we can achieve this like i saw something called conditional trigger through event based I am not sure how do we setup this. 
Please let me know if is there a way to call modal using client script or how do i solve this issue 


Thank you 
Prajwal 

2 REPLIES 2

Dinesh Chilaka
Kilo Sage

Hi @pgvaishnav ,

Let's create a client script like this,

/**
 * @param {params} params
 * @param {api} params.api
 * @param {any} params.event
 * @param {any} params.imports
 * @param {ApiHelpers} params.helpers
 */
function handler({
    api,
    event,
    helpers,
    imports
}) {
  
    helpers.modal.close();
    if (event.payload.value == 'user') {
        helpers.modal.open("[component-id$='second_modal']");
        //here replace the second_modal with the id of  your second modal

    } else {
        helpers.modal.open("[component-id$='third_modal']");
         //here replace the third_modal with the id of  your third modal


    }

}

Execute the above client when choice is selected in first modal,

Screenshot 2026-03-30 at 12.05.25 PM.png

 

If my response helped, mark it as helpful and accept the solution.

yashkamde
Mega Sage

Hello @pgvaishnav ,

 

can you elaborate your issue or share some screenshots ??

 

In my case I had called client script parameter by updating

Screenshot 2026-03-30 114006.png

 

As soon as button clicked update the client state parameter by passing the values (sys_id's) :

Screenshot 2026-03-30 114515.png

 

Then as soon as btn clicked pass the updated client state parameter and update the values :

Screenshot 2026-03-30 114047.png

 

If my response helped mark as helpful and accept the solution.