I need help returning two values (tableName and query) to update client-state parameters UI Builder
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I need to update two client-state parameters—tableName and query—when clicking on a data-visualization item in my UI Builder. I’m not sure how to correctly return and assign multiple values. I attempted some code, but it isn’t working. Can someone help me with the proper syntax?
/**
* @param {params} params
* @param {api} params.api
* @param {any} params.event
*/
function evaluateEvent({
api,
event
}) {
var query = event.payload.params.query;
var table = event.payload.params.table;
console.log("query " +query);
console.log("table " +table);
return {
updates: [
{ propName: "queryParam", value: query },
{ propName: "table", value: table }
]
};
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Sorry mate, code is not my expert area.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Sathwik1,
and what does your code do, have you tried to log something?
Please give some context: "When I do 123, I expect 456 to happen, but instead it's 789 that happens"...
This reply is 100 % GlideFather and 0 % AI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I’m facing an issue with the return-statement syntax when trying to update Client State parameters. My console.log statements are printing correctly, so I know the click handler is being triggered, but the Client State values aren’t updating.
In my UI Builder layout, I have two rows.
The first row contains two data-visualization cards:
Card 1 shows the count of active incidents
Card 2 shows the count of active problems
In the second row, I’m using a simple list component.
The list should display data based on whichever data-visualization card (in row 1) the user clicks.
To achieve this, I’m passing the table name and query through Client State parameters.
My problem is.. I’m not sure how to correctly write the return statement to update the two Client State parameters each time a card is clicked. Both the table name and query need to be updated on every click, but I’m unable to get the syntax right.
Can you help me understand the correct return format for updating multiple Client State parameters?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Sathwik1 I'm sorry but I don't know what you want to achieve, I have never used the UI Builder and try to avoid it as much as possible :(( perhaps if you know of some similar feature in UIB, you can take a prototype from it and adjust accordingly.
You have there console.log, what does it give you?
This reply is 100 % GlideFather and 0 % AI
