Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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 '14 at 9:35

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.

share|improve this answer
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 '14 at 9:33

You can use following script to get schema Title: taken from

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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