Remote tables, rows not adding even through .addRow() is returning true?

David Nendza
Tera Guru

I am diving in to remote tables, I made one that doesn't do anything fancy with queries, just grabs info and populates the table - this works fine.

 

I have another remote table that I want to populate when someone queries for a specific ID.  So in the remote table definition I have a check like 'if (v_query_getParameter('id')) {  <query the remote system and populate the table> }
My action is being executed, the object being returned is in the proper format and the fields are matching the fields on the table.  The v_table.addRow(row) statement is returning true, yet the table will not show anything.

 

Do I need to have code in there to pull 'something' if no query is passed?  The purpose of this table is to hold temp information about a single, queried thing (that might return multiple records).

2 REPLIES 2

Shivalika
Mega Sage

Hello @David Nendza 

 

Can you share your script definition for this remote table? 

 

Also refer this example script definition from servicenow and tweak few things in your script in case it varies. 

 

https://www.servicenow.com/docs/bundle/xanadu-servicenow-platform/page/administer/remote-tables/refe...

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

I figured out the issue.  After my transform action, I was generating and setting the sys_id by doing row.sys_id = <code to make a sys_id>;, right before the row.add() function and this wouldn't work, even through the row.add() returned true..  Once I changed this to parse my object, add the sys_id to it, run the transform and update the transform rules to use the sys_id column, the rows displayed.

 

Remote tables sure are interesting.  Also ran into an issue when I tried to click into a record to go to form view, it would say record not found.  Which is when I figured out it queries the remote table multiple times when you click into it and if you aren't doing something where the sys_id isn't generating exactly the same for the same record, you will run into issues like this.