UI Builder: How do I link to a destination and pass parameters?

thomaskennedy
Tera Guru

I'm trying to link to another page ("Create Service Request"), in the current window, and pass the one required parameter ("deviceSysid"). I've not been able to discover the syntax for this. Do I pass an array, or a String, or an object?

This page, which calls Link to Destination Relay (a handler I do not see for some reason) suggests that I pass an object, so I tried variations on this:

function evaluateEvent({api, event}) {
	return {
		route: "create-service-request",
		fields: null,
		params: {"deviceSysid":"-1"},
		...
	};
}

But I get The page you are looking for could not be found, and the intended param does not appear on the resulting page.

So I tried this:

function evaluateEvent({api, event}) {
	return {
		route: "create-service-request",
		fields: null,
		params: "-1",
                ...
	};
}

with the same result. So how do  Ido this?

 

 

 

 

1 ACCEPTED SOLUTION

thomaskennedy
Tera Guru

FYI this is the syntax when using Link to Destination:

function evaluateEvent({api, event}) {
	return {
		route: "service-request",
		fields: {"sysId":event.payload.row.sys_id.value},
		params: null,
		redirect: null,
		passiveNavigation: null,
		title: null,
		multiInstField: null,
		targetRoute: null,
		external: null
	};
}

route must be a Route from the sys_ux_app_route table.

fields is for required parameters.

params is the same syntax, but for optional parameters.

If you want your target to open in a new window, use external:

function evaluateEvent({api, event}) {
	return {
        route: null,
        fields: null,
        params: null,
        redirect: null,
        passiveNavigation: null,
        title: "",
        multiInstField: null,
        targetRoute: null,
        external: {
            url: "/x/aaa/bbb/<route>/" + param1
        }
    };
}

 

View solution in original post

3 REPLIES 3

thomaskennedy
Tera Guru

FYI this is the syntax when using Link to Destination:

function evaluateEvent({api, event}) {
	return {
		route: "service-request",
		fields: {"sysId":event.payload.row.sys_id.value},
		params: null,
		redirect: null,
		passiveNavigation: null,
		title: null,
		multiInstField: null,
		targetRoute: null,
		external: null
	};
}

route must be a Route from the sys_ux_app_route table.

fields is for required parameters.

params is the same syntax, but for optional parameters.

If you want your target to open in a new window, use external:

function evaluateEvent({api, event}) {
	return {
        route: null,
        fields: null,
        params: null,
        redirect: null,
        passiveNavigation: null,
        title: "",
        multiInstField: null,
        targetRoute: null,
        external: {
            url: "/x/aaa/bbb/<route>/" + param1
        }
    };
}

 

Hey Thomas, glad you got this figured out. Basically, in UIB whenever you see "fields" in relation to pages that is the same thing as "required parameters". At some point it was renamed from fields to required parameters but not changed everywhere.

Any idea why I can't use any external URL in the "external" variable? Doesn't work for me but I can do it in the form....