Help

Finding record ID using a field value, Node.js

Topic Labels: ImportingExporting
1397 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Jason_SSS
4 - Data Explorer
4 - Data Explorer

Hello, I am trying to implement a leaderboard in my game, and am having issues with getting the record ID for a record based on the user’s unique UserID from my base, so I can update that record.

I searched and found this post with 2 different examples, but wasn’t able to adapt them to my use. Here is my code, with the field from my base being “userid” and “recordid” being the variable I want to fill with the Record ID:

const myuseridstring = String(myuserid);

  base('Table 1').select({
    filterByFormula: '{userid} = "${name}"',
    }).eachPage(function page(records, fetchNextPage) {
    
    records.forEach(function(record) {
    console.log('Retrieved record', record.getId('myuseridstring'));
    recordid = record.getId('myuseridstring');
    });
    }, function done(error) {
    });

I appreciate any help, I’ve been stuck on this for a while. Thanks!

0 Replies 0