Public Method Author API

setActivityItems()

Sets the Items to be used in the Activity being edited. This overwrites the current Items in the Activity.

You would want to use this method so that you can programmatically add default Items when a new Activity is created, for example.

If using Items from multiple Item banks for an Activity, you can set up an array of ItemBankDefinition as an entry in Activity edit's item_banks.

Examples

var hasSetActivityItems = authorApp.setActivityItems(
    [
        {
            reference: "test1",
            organisation_id: 1
        },
        {
            reference: "test3",
            organisation_id: 1,
            item_pool_id: "pool_1"
        }
    ]
);
console.log(hasSetActivityItems);

Arguments

  • items array[ItemObject]

    An array of Item references.

Return value

boolean

Returns true if successful.

Returns false if unable to to set the Activity Items, for example, when not in the Activity editor view.

Type definitions

ItemBankDefinition object

  • organisation_id number

    This refers to the Item bank from which the Items are loaded.

  • item_bank_name string

    The display name of the Item bank.

  • item_pool_id string

    The ID of the Item pool from which Items are loaded.

  • filter object

    An Item filter for the Item bank. The object structure is the same as the item_search.filter initialization option.

Related articles

Was this article helpful?