We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

UI Builder Open or Close Modal Dialog Script Syntax

kelseydougl
Tera Guru

I have a list component, and I am trying to add a scripted event, "Open or close modal dialog", for "Reference Link Clicked", which should open a viewport modal and display the relevant record. I need to pass two required parameters, table and sysId, which I am trying to pass through a scripted event handler, but it is not opening the modal. After a lot of testing, I believe the issue is the syntax, so does anyone here know the correct syntax, or why this may not be working? This is the code:

 

function evaluateEvent({api, event}) {
	return {
		modalId: 'modal_viewport_1',
		showModal: true,
		displayOptions: null,
		bare: null,
		viewportElementId: 'viewport_1',
		viewportRoute: 'modal-record',
		viewportFields: {
			table: event.payload.table,
			sysId: event.payload.sys_id
		},
		viewportParams: null
	};
}
1 REPLY 1

GersonCF
Tera Contributor

Hey Kelsey,

 

I made the modal work by changing to this:

 

return {
modalId: "[component-id$='custom_1']",
showModal: true,
displayOptions: null,
bare: true,
viewportElementId: null,
viewportRoute: null,
viewportFields: null,
viewportParams: null
};

 

custom_1 in my example is the id of my custom modal. Hopefully it works for you as well