circuit-sdk

How to get an item by itemId in Circuit JS SDK?


I handle a formSubmission event on Circuit using Circuit JS SDK. Then I update an item that contains this form by using method updateTextItem. I want to save previous value of item.content. But received event contains only itemId. Is it possible to get item by itemId to get content?

client.updateTextItem({
      itemId: event.itemId,
      form: {
          id: event.form.id,
          // content: ???,
          controls: [{
                type: 'LABEL',
                text: submittedValue
          }]
      }
});

Solution

  • Use API getItemById or getItemByIds. https://circuitsandbox.net/sdk/classes/Client.html#method_getItemById