1

Is there a way to get the default bookmarks with capability APIs?

I tried app.getList('BookmarkList') method, but it doesn't return any parameter identifying that it's a default bookmark.

Stefan Stoichev
  • 4,615
  • 3
  • 31
  • 51
Ryan Arpe
  • 38
  • 4

1 Answers1

1

In order to get the default bookmarks you'll have to create generic object with the following definition:

app.createGenericObject({
  qInfo: {
    qType: 'sheets'
  },
  qAppObjectListDef: {
    qType: 'sheet',
    qData: {
      title: '/qMetaDef/title',
      labelExpression: '/labelExpression',
      description: '/qMetaDef/description',
      descriptionExpression: '/descriptionExpression',
      thumbnail: '/thumbnail',
      cells: '/cells',
      actions: '/actions',
      rank: '/rank',
      columns: '/columns',
      rows: '/rows'
    }
  }
}, sheets => {
  console.log(sheets)
})

The key here is the /actions part of the definition which ensures that the actions metadata is received

The resulting layout should include any defined actions, which, for bookmarks will look like this:

{
  actionLabel: "A",
  actionType: "applyBookmark",
  bookmark: "db014c67-ff43-4111-88ff-836b457928e5",
  cId: "KzmaWSa",
  field: "",
  showSystemVariables: false,
  softLock: false,
  value: "",
  variable: ""
}
Stefan Stoichev
  • 4,615
  • 3
  • 31
  • 51