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?

On this episode, join Brad, Chuck, and Earl as they explore viewports in UI Builder in the Rome release. Useful Links: * Community Live Stream: Document IDs https://community.servicenow.com/community?id=community_blog&sys_id=d3fec975db2d9410d58ea345ca9619e0 * Platform Academy Series ...
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

_Damian
Tera Contributor

@IronPotatothx for reply, well to OOB SRP Record Page I have added a viewport and I have attached my custom page collection (viewport type) so probably you are right however I have Inherited data resources. Do you know how I can add this parent child relation or check if I have it already properly configured? 

I think I saw article or reply from Brad Tilton that page collections are working differently and the only way how to send the data to them is via page properties. If you have a chance to create viewport instead of page collection just change it and it should work.

Ahh After I changed in viewport component from page collection to viewport than I have option to create sub page but unfortunately I need to use page collection as I want them to be generic/reusable on some other pages and what I need to be able to pass some data between page and page collection that is opened in viewport component.

You are right, I only just stumbled over Brad Tilton's comment on this exact topic:

"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...