Table of Contents

The OLD $2sxc.cms.run(...) API v9.30

Warning

This is documentation for an old feature. You should use the new one instead

How to use (v9.30)

Before you start, ensure you have the necessary JS scripts loaded. See Activate 2sxc JavaScript APIs on a Page.

Simple example:

<script>
    // simple function to run the command and handle the returned promise
    function addProject(tag) {
        $2sxc.cms.run(tag, "new", { contentType: "Project"})
            .then(function () {
                alert("Thanks - we'll review your entry and publish it.")
            });
    }
</script>

<span onclick='window.addProject(this)'>
    add your project
</span>

  1. the first parameter is an HTML tag in the DOM, which is used to look up the context automatically (see edit-context)
  2. the second parameter is the verb for the cms-command to run
  3. the third parameter is additional parameters for that command

History

  1. Introduced in 2sxc 09.30
  2. Made obsolete with new RunParams in 2sxc 12.10 to support registering workflows - see SxcGlobalCms