How to show open or close Model Dialog based on condition by using script in UI Builder.

upendar5
Tera Contributor

I want to show Open or Close model Dialog box based condition by using script in UI Builder.
Can anyone please help me with this.
Thanks Upendar. 

1 REPLY 1

Nootan Bhat
Kilo Sage

Hi @upendar5,

Once you call the client script from your condition builder/ button and any other component you can call the model open or close using the helpers api.

refer: https://docs.servicenow.com/bundle/utah-api-reference/page/app-store/dev_portal/API_reference/helper...

 

function handler({api, event, imports, helpers}) {
  helpers.modal.open("[component-id$='alert_modal']") // define your model id inplace of alert_modal
}

 

let me know if it was useful.

 

Thanks