Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

Re: "Unnamed record" in automation script

Solved
Jump to Solution
3072 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Matthew_Weidert
5 - Automation Enthusiast
5 - Automation Enthusiast

Hey there - script writing newbie here. Anyone know why this is returning "Unnmed record" in my summary? The primary field definitely is not blank. It's a single line text field, some of which are a bit longer, with 20 words.

Appreciate the help!

1 Solution

Accepted Solutions
Grunty
7 - App Architect
7 - App Architect

Hey Matthew,

The definition of the query for 'To Do List' is missing the name field:

let linkedQuery = await linkedTable.selectRecordsAsync({fields: ['Primary field name here!', 'Status Calc']});

In your code, when you reference 'incomplete.name' in the summary, the interpreter assumes the existence of a name field, but finds no values retrieved for it, hence labels them "Unnamed record".

See Solution in Thread

7 Replies 7

What displays if you do a console.log(incompleteRecords)? Do the names show up there? Can you match the record IDs of the records with the records in the grid view to ensure that you actually have the correct records?

Grunty
7 - App Architect
7 - App Architect

Hey Matthew,

The definition of the query for 'To Do List' is missing the name field:

let linkedQuery = await linkedTable.selectRecordsAsync({fields: ['Primary field name here!', 'Status Calc']});

In your code, when you reference 'incomplete.name' in the summary, the interpreter assumes the existence of a name field, but finds no values retrieved for it, hence labels them "Unnamed record".

Hi,

Would like to suggest - you can use selectRecordAsync(id) to retrieve a single record (lines 5,6).
You can also put a part of your scripting job to the native automation by retrieving array of IDs (from 'To Do list') into another input varialble. Use 'Edit token', make a new list of...  (and you can also retrieve list of Names)

(just for example)

Alexey_Gusev_0-1676119970944.png

I think, it may help you to debug the issue with 'Unnamed'

Also, just for info - you can get your linkedRecords directly in line 7, without line 8, using not only 'fields:', but another option - 'recordIDs'.


@Grunty wrote:

In your code, when you reference 'incomplete.name' in the summary, the interpreter assumes the existence of a name field, but finds no values retrieved for it, hence labels them "Unnamed record".


The ".name" property of the record exists, even if the primary field has not been included in the query results. It is also slightly different from the primary field value. The name property of a record is always a text string, but the primary field value could be a number or a date.

Grunty
7 - App Architect
7 - App Architect

Yes, the ".name" property of the record always exists, as it’s a part of the object structure. But it being fed actual values depends on whether the primary field is declared in the query enumeration or not.

I recall a stormy night I was console.logging records using .name and it wouldn’t appear on the log. It took me a while to realise that I had missed declaring the primary field on the query. Once I did, the values of record.name showed up on the log.

I see in Matthew’s screenshot that seems to be the case.

I remember I encounter some bug using .name, results were different from expected. I had no time to investigate deeper, when I changed it to .getCellValue('Primary_field_name') and added it to {fields:}, it worked OKNow I understand what was wrong, thanks.

Matthew_Weidert
5 - Automation Enthusiast
5 - Automation Enthusiast

Thanks for everyone's input! Grunty, that fixed it 💥