The CreatorCon Call for Content is officially open! Get started here.

Next Experience: How to propagate an Event from a Modal Page into Host (Record Page)?

David Hubbard
Tera Guru

I have a UIB Page loaded into a Modal on a Standard Record Page.  When the action in the modal is done (updated database) I want the Record Page to refresh.

 

The Modal Page uses Transform Data Broker to complete the action and control is passed back to client script in UIB Modal Page. 

 

So what would I need to configure to get the Record Page - which is hosting the modal on "modalContainerViewport".  In summary I 'm guessing I need to:

1) Configure a "Dispatched Event" on Modal Page e.g. "MY_MODAL_EVENT"

2) in Client Script "api.emit" the event

3) Configure a "Handled Event" on ("MY_MODAL_EVENT") on the Record Page

4) Add an Event handler on that Handled Event to run client script.

5) Do something (api.helpers?) to refresh the page.

Unfortunately nothing I have tried along these lines works - there doesn't seem to be any linkage between the Modal Page and the host page - as they are not "Sub Pages" (with a parent) nor "Page Collection" (with a controller).

 

Any help appreciated.

2 REPLIES 2

DrewW
Mega Sage

Ok so you want to just refresh the window when the frame closes?  I think you can just use something like the below with you client script on a workspace.  I have not tested it though.

var sm = g_modal.showFrame({
	title: getMessage("Search Members"),
	url: url,
	size: 'lg',
	height: '25rem',
	autoCloseOn: 'URL_CHANGED',
	callback: function (ret) {
		location.reload();
	}
});

 

Hi.  This is in a Next Experience Scoped Application so am not loading it via "g_modal.showFrame". 

 

Plus - I am actually wanting the record page to refresh - as it does on a "Save" - so don't really want a full page/tab reload.