Element.saveAsElement (Method)

Creates a new saved element from a source element.

Returns:

ElementTypeID (structkeylookup)

Arguments:

Name Type Required Description
pageID RealPageID_0 Required The ID of the page from which CommonSpot will create a new element.
elementInstanceID ControlID_0 Required The ID of the source element to create a new element from.
name PlainText_NonNull_255 Required The name of the new element.
description PlainText_NonNull_2000 Required The new element's description.
categoryID ElementCategoryID_0 Required The ID of the new element's category.
copyElementContent Boolean Required Boolean flag which when set to true tells CommonSpot to copy the source element's content into the saved element. CommonSpot ignores this argument if it is updating a saved element.

Context:

License Requirements None
Permission Requirements Contributor
Deny Context None
Require Context AuthoringEnabled
Author Lock (not required)
Transaction Logging If transaction logging is enabled at the site level, calls to this method will be logged
Customization This method may be customized at the site level

Error Codes:

Code Error Message
15019 To create a new element, you must specify the page on which the source element will exist.
15020 When creating a new element form, you must specify the source element's ID.

Notes:

When a saved element is added to a page, an instance of the element from which it was derived is inserted. For example, if you have an image element and you save an element from that named 'CompanyLogo' when choosing a CompanyLogo element from the element gallery, CommonSpot inserts an image.