UI Builder Page Collection Bubble Event

nwilliam
Tera Contributor

I have a viewport using a page collection that I would like to have a button that bubbles up an event to the main page.

I tried the "bubbling up" method here: https://www.youtube.com/watch?v=PwZLd2phUZQ

But they were using viewports/sub pages so I think what worked there does not work with page collections.  How would I go about getting a button to trigger an event on a parent page from a page collection viewport?

1 ACCEPTED SOLUTION

Hi @IronPotato

do you know how to perform this miracle?


I am having the same issue as @nwilliam . I managed passing params down to the page collection page using a controller, but my event won't bubble up from the child page (page collection) to the parent page. I had the same issue when creating custom components, but it is possible to fix it by adding the event manually in the "eventMappings" (page definition) of that component. Unfortunately this does not seem to work for Viewport Components with Page Collections.

 

On the child page I added a dispatch event on the body, that is triggered by a click event on a button:

fujan_0-1733846963507.png

fujan_1-1733847010823.png

On the parent page I added the same event in the body's handle event section:

fujan_2-1733847221235.png

Now calling this handled event like in the above video does not work for me.

 

 



 

View solution in original post

13 REPLIES 13

@fujan , glad that It worked. I'm on Xanadu so yeah there might be also changes how to do it.

@fujan 
Just circling back to this trying to do the same thing with a different viewport.  I'm using a "tabs" page collection and I'm not getting this to work after following your fix (I'm able to get it on a normal viewport).    In particular step 3...I can see the relay was added to Dispatched events...but I don't see it as its own event mapping to add handlers to (which is what I believe I'm supposed to do in step 3)...any advice?

What if I do not have "Inherited event handlers" available so that I can not perform point 2?

Hi @_Damian ,

 

If page is not inheriting events from parent, my guess would be that the page you are on is not direct child of the page where you created the event.

Brad Tilton from ServiceNow has shed some light onto this particular situation:

"Page collection pages use controllers on the parent page to communicate so the only way to communicate from the PC page to the parent page is to call an event handler on the parent page's controller. "
https://www.servicenow.com/community/next-experience-forum/how-to-send-event-from-page-collection-to...