UIBuilder Modal with onSubmit Client Script

Thomas Walker2
Tera Guru

I'm currently working within the CSM configurable workspace and am trying to make a modal trigger with a onSubmit client script. I got it working with the g_modal object, but the modals you can create are super basic without deep configuration and creation of custom components.

I tried not using the onSubmit client script and triggering the event from the page events, but my form is within a record tabs component and it doesn't seem to trigger the Screen Status Changed event as suggested here: https://www.ninjabytes.blog/uib_advance/part-40-reset-the-form-automatically-after-submission/. The event just didn't seem to come through as expected.

I know I could override the UI Action for the save button, but that feels super hacky and like there would be edge cases for submission like the update button in playbook within record tabs. https://community.servicenow.com/community?id=community_question&sys_id=10b9dd36db217050b3c099ead396...

Any direction as to how I might trigger an UIBuilder dispatched event/on page modal from a platform onSubmit client script or whether I'm barking up the wrong tree would be greatly appreciated.

 

 

 

1 ACCEPTED SOLUTION

Marc Mouries
ServiceNow Employee
ServiceNow Employee

The script on the ninjabytes page is inside a page script in a UI Builder page not inside a platform client script. 

This is easily implementable in a configurable workspace in UIB. You might be encountering a CSM limitation and you may want to post in the CSM channel.

Can you elaborate on the use case you are trying to implement?

View solution in original post

2 REPLIES 2

Marc Mouries
ServiceNow Employee
ServiceNow Employee

The script on the ninjabytes page is inside a page script in a UI Builder page not inside a platform client script. 

This is easily implementable in a configurable workspace in UIB. You might be encountering a CSM limitation and you may want to post in the CSM channel.

Can you elaborate on the use case you are trying to implement?

I'm trying to get a CSM UI builder modal to appear on the submission of a record. I know how to make the modal appear/disappear from within UI builder with events, but have no way to trigger those events on submission without overriding the UI actions as far as I can tell.

I ended up just writing a UI page and using g_modal.showFrame within a platform onSubmit client script which I knew was a fallback.