UI Builder - Custom Component Dispatch Events

joshkeegan
Tera Contributor

I'm looking to trigger a refresh on a list component based on an action that occurs in my custom component. I have a dispatch function that contains a payload object.  I created a ux event for this dispatch action, I added it to my macroponent and I see this event in the builder UI. 

Documentation followed
https://developer.servicenow.com/blog.do?p=/post/quebec-ui-builder-custom-component-events/ 

https://developer.servicenow.com/blog.do?p=/post/quebec-ui-builder-custom-component-events/

Using the Next Experience inspector chrome extension. I see my event was triggered and has a payload

joshkeegan_0-1755202191789.png

 

I would like to look at the payload and see if success is true. If my bool is true then i would want to execute a client script to refresh my list.

function handler({api}) {
    api.setState('listRefreshed', {timestamp: Date.now()});
}


I'm having trouble connecting the events. Here is the structure of my page 

joshkeegan_1-1755202457952.png


Where "my component" in the modal is the custom component and "list 2" is a remote table. Upload Document button is a declarative action opening the modal with the custom component. 

Any resources on being able to access dispatched events from other components would be very useful. I haven't found much documentation around these.

1 ACCEPTED SOLUTION

joshkeegan
Tera Contributor

The issue was i didnt clear the ui builder cache. Once I did that, the events tab was visible on my custom component.

View solution in original post

1 REPLY 1

joshkeegan
Tera Contributor

The issue was i didnt clear the ui builder cache. Once I did that, the events tab was visible on my custom component.