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
Hi @Sathwik1 ,
I tried your problem in my PDI please check below screen shot and script
If you want to give dynamic props from script
please follow below syntax.
You can also find this thing from official docs from ServiceNow
Let me know if you need more help!
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Thanks Sharath for your reply.. but what should I pass in the simple list component.. for table and filter? will it automatically set?
My requirement is.. In First column I want to show two Data Visualization.
One for Incident, another for problem.
Now in second column I want to show one simple list.. based on selection in the data visualization those records needs to show... So I'm trying to set client state parameters so that these client State parameters I can call in simple list table and filter part..
@Sarthak Kashyap can you please confirm if your suggested solutions works here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Sathwik1 ,
Sorry for late reply, you have to create a client script and call that client script on body event, when load is ready. So when ever you loads a page, your client script will execute and your props will set.
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
