view port fields in open or close dialog ui builder

Quratulain Adna
Tera Contributor

Hi 
please let me know the usage and sample json for this in ui builder

pls help @Brad Tilton 

QuratulainAdna_0-1676650817806.png

 

2 REPLIES 2

JagjeetSingh
Kilo Sage
Kilo Sage

Hi,

This is to pass the required or optional parameters for your viewport pages.

 

I guess here you are using viewport modal. When you create a page in the viewport and add any required parameters to the page, you can pass the values of those parameters via viewport fields option.

 

For example, if your viewport modal page has "table" as a required parameter to do some operation, you need to pass the table name while rendering your modal. You can set the "table" from this option.

 

 

Jagjeet Singh
ServiceNow Community Rising Star 2022/2023

emirmirou
Tera Contributor

I have the same problem here, I need to pass an optional parameter "sysId" by passing a client state, how can I access the client state with the json, there is no option to select the optional parameters "sysId"? 
Another alternative ist the script option but I don't know how to configure it, actually I don't know what I should write in showModal option (I think it's the one responsible for opening the modal)

/**
@Param {params} params
@Param {api} params.api
@Param {any} params.event
*/
function evaluateEvent({api, event}) {
    return {
        modalId: 'modal_viewport_3',
        showModal: null,
        displayOptions: null,
        bare: null,
        viewportElementId: 'viewport_2',
        viewportRoute: 'okr-creation',
        viewportFields: null,
        viewportParams: {'sysId': api.state.selectedOKR}
    };
}