- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 11:34 AM
There is need to customize drop down in UI Builder, when incident selected, there should be form of incident record and if second option selected, there other table should show.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 12:08 PM
@rah dev you can implement following steps:
create client script and use this code:
/**
* @param {params} params
* @param {api} params.api
* @param {any} params.event
* @param {any} params.imports
*/
function handler({
api,
event,
helpers,
imports
}) {
var table;
switch(event.payload.item.id){
case "incident":
{ table = "incident";
break;}
case "change request":
{ table = "change_request";
break;}
}
api.emit('NAV_ITEM_SELECTED', {
route: "record",
fields: {
table: table,
sysId: "-1"
}
});
}
Create client state:
Add your above client script on dropdown events:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 01:10 AM
Have you looked at that particular component of the Compliance Workspace in the UI Builder?
Looks like a Dropdown component, you can find the configuration details in the documentation - https://developer.servicenow.com/dev.do#!/reference/next-experience/washingtondc/now-components/now-...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 12:08 PM
@rah dev you can implement following steps:
create client script and use this code:
/**
* @param {params} params
* @param {api} params.api
* @param {any} params.event
* @param {any} params.imports
*/
function handler({
api,
event,
helpers,
imports
}) {
var table;
switch(event.payload.item.id){
case "incident":
{ table = "incident";
break;}
case "change request":
{ table = "change_request";
break;}
}
api.emit('NAV_ITEM_SELECTED', {
route: "record",
fields: {
table: table,
sysId: "-1"
}
});
}
Create client state:
Add your above client script on dropdown events: