Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

I need help returning two values (tableName and query) to update client-state parameters UI Builder

Sathwik1
Tera Expert
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 }
]
};
}

@Ankur Bawiskar 

1 REPLY 1

Sarthak Kashyap
Kilo Sage

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.

var query = 'active=true'

api.context.props.query(query);
 
 
SarthakKashyap_1-1763150281534.png

 

You can also find this thing from official docs from ServiceNow 

SarthakKashyap_2-1763150354306.png

Link

 

Let me know if you need more help!

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards,

Sarthak