Issue with Object.keys

For more reference:   {{
let LinksArray = [];

// Check if the selected row and emailsQuestions exist
if (table2.selectedSourceRow && table2.selectedSourceRow.emailsQuestions) {
let emailsQuestions = table2.selectedSourceRow.emailsQuestions;

for (let i = 0; i < emailsQuestions.length; i++) {
  let email = emailsQuestions[i];

  // Check if the Provenance and reference exist for this email
  if (email.Provenance && email.Provenance.Reference) {
    let reference = email.Provenance.Reference;
    for (let j = 0; j < reference.length; j++) {
      let currentReference = reference[j];
      
      // If Object.keys is available and is a function
      if (typeof Object.keys === 'function') {
        let keys = Object.keys(currentReference);
        if (keys.length > 0) {
          LinksArray.push(`<a href="${keys[0]}" target="_blank">link${j + 1}</a>`);
        }
      } else {
        // Fallback: Using for...in loop if Object.keys is not available
        for(var key in currentReference) {
          if (currentReference.hasOwnProperty(key)) {
            LinksArray.push(`<a href="${key}" target="_blank">link${j + 1}</a>`);
          }
        }
      }
    }
  }
}

}
return LinksArray.join(", ");
}}
here is my code, I am not able to get all the keys of an object using Object.keys . Can some buddy guide me here . Here is the sample data on which i am trying this code object =
{
"Automated & Manual Accessibility Testing | Level Access": 50
},

Hi @ChandanTiw Thanks for reaching out!

Can you try removing the {{}} around the code?

Assuming this code is inside a transformer, you'll want to add {{}} only around the references to the table:

if({{table2.selectedSourceRow && table2.selectedSourceRow.emailsQuestions}}) {

let emailsQuestions = {{table2.selectedSourceRow.emailsQuestions}};

If the code is in a Javascript query, then you won't need {{}} at all

If you're still running into issues, can you add console.log(currentReference) after this line: let currentReference = reference[j]; and post the results of the console log here? (or let us know what the data structure is if you can't share the results)