We have the below code

var itemType = $models.getItemType(selection.getItem(0));
if itemType == $const.ItemType.COMPONENT  

I want to check which schema is used for this component, based on this I want to enable user defined button in the ICM ribbon.

Please share the code how to check the component based on particular schema in JavaScript.

  • You question title and description is confusing, in title it says. "component based on schema", & in description it says. "which schema is used for this component", Please clean your question
    – Raj Kumar
    Jun 25, 2014 at 9:35

2 Answers 2


You may want to refer the below code to retrieve items filtered on the basis of a Schema TCM URI in Anguilla Framework:

$item = $models.getItem(id); 
$criteria = new Tridion.ContentManager.ListFilter();
$criteria.conditions.ItemTypes = 16;                //Get all items of type Component
$criteria.conditions.BasedOnSchema = "tcm:1-100-8"; // TCM URI of your Schema
$criteria.conditions.InclLocalCopies = true;       // Retrieve the Local Copies as well

// List of Components based on schema in Criteria
$list = $item.getListUsingItems($criteria, false, false); 

I hope this helps you start.

  • i think he is asking to find the schema, but your answer suggest user should already know the schema id. i also think question is also confusing
    – Raj Kumar
    Jun 25, 2014 at 9:33

You can use following script to get schema Title: taken from https://stackoverflow.com/questions/11257535/how-to-get-the-schema-name-from-the-schema-object-in-tridion

var schemaObject = $models.getItem("tcm:8-32597").getSchema();
var schemaTitle;
function loaded()
    schemaTitle = schemaObject.getTitle();
$evt.addEventHandler(schemaObject, "load", loaded);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.