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

Not applicable

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 @Community Alums,

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/helpers/concept/helpersAPI.html#title_helpers-modal-open_S_O

 

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