duplicateItem - Methods - Author API

Author API Methods

duplicateItem()

Duplicates the current Item being edited. If the operation is successful, the duplicate Item is automatically loaded and saved.

All Questions and Features in the Item are fully cloned with new internal UUID references (except for passages, see caveats).

Note The duplicate Item is not persisted in the Item bank if config.item_edit.item.save.persist option is false. Item duplication using this method is not supported when editing an Item within an Activity.

Alternatively, this method can be called by passing in an object as the first argument with additional settings.

Examples

// Duplicate an Item with a new generated reference and duplicated passages
authorApp.duplicateItem('', true); 

// Duplicate an Item with additional settings
authorApp.duplicateItem({
    reference: 'NewReference',
    showConfirmationScreen: true,
    duplicateSharedPassages: true
});

Arguments

  • reference string object

  • duplicatePassages boolean

    If set to to true, passages are duplicated among Items. If set to false, passages are shared.

    Default: false

Return value

Type boolean

Returns true if it's possible to attempt duplication, or false if unable to attempt duplication, for example, when not editing an Item, the passed reference is not valid, Item is empty.

Caveats

Passages are not duplicated and will be shared between the original "master" Item and the newly duplicated Item.

Note This method may throw an error later despite returning true (boolean) if something goes wrong, for example, if the passed reference is used by an existing Item in the Item bank.

Was this article helpful?

Did you arrive here by accident? If so, learn more about Learnosity.