1

I have a Schema, it has a component link field. Whenever I insert a component , unable to find its reference in getContentSection method. I have Validation on the Save/SaveClose command

if (item) {
        $evt.removeEventHandler(item, "load", MyFunction);
        if (item.getItemType() == $const.ItemType.COMPONENT) {
            if (item.getSchema().getInfo().Title == "TestSchema") {
            if(item.getChanged()){
               console.log("getContentSection:"+item.getContentSection());
               console.log("getNewXmlDocument:"+$xml.getNewXmlDocument(item.getContentSection()));
               }
            }
            $evt.addEventHandler(item, "load", MyFunction);
            item.load();
        }

    }
  • Is it an optional field? In XML, optional fields with no values will not appear. – Nuno Linhares Mar 2 '17 at 12:37
  • It has values, but unable to get the updated details. Is there a way of getting changes in component through SourceTab content – Kumar_diru Mar 2 '17 at 13:29
0

To retrieve the contents of any type of container in the Content Manager you can use the GetListItems() method, which returns a DOM document, or the GetItems() method which returns a Collection of objects.

TOM.NET classes that use the GetListItems() and GetItems() methods The following TOM.NET classes use the GetListItems() and GetItems() methods to filter lists of items contained in this type of container:

  • Repository ( Tridion.ContentManager.ContentManagement.Repository)
  • Publication (Tridion.ContentManager.CommunicationManagement.Publication)
  • Organizational Item (Tridion.ContentManager.ContentManagement.OrganizationalItem), the parent class of the following four classes
  • Category (Tridion.ContentManager.ContentManagement.Category)
  • Folder ( Tridion.ContentManager.ContentManagement.Folder)
  • Virtual Folder ( Tridion.ContentManager.ContentManagement.VirtualFolder)
  • Structure Group ( Tridion.ContentManager.CommunicationManagement.StructureGroup)

Parameters and return values

Depending on the item type, both the GetListItems() and GetItems() methods take a parameter of either class RepositoryItemsFilter or OrganizationalItemItemsFilter, that lets you specify how the results of the method call are to be filtered:

  • In a GetListItems() call, you can restrict the amount of information that is returned for each item (for example, only the ID and title of each item)
  • In both methods, you can restrict which items are returned from the total set of items contained in the container (for example, only items that are Components)

The return value of each method is different:

  • A call to GetListItems() returns an XML document that consists of one tcm:ListItems element containing zero or more tcm:Items elements.
  • A call to GetItems() returns an IEnumerable of those objects in the container that match the filter criteria.

Please try this code.

var item = this.getItem();
var modifiedDate = item.getLastModifiedDate() || item.getStaticLastModifiedDate();
  • This may be correct, but Stack Exchange automatically flags a three-line answer as being of low quality. I suppose they have a point; I'm sure if you added some explanation it would be a better answer. – Dominic Cronin Mar 2 '17 at 18:41
  • Hi Rao, I'm looking for changes done in component not modified date – Kumar_diru Mar 3 '17 at 4:47
  • please share full source code. after update code changes. you clear the browser cache and history?. – Sudhakar Rao Mar 3 '17 at 5:34
  • Yes I cleared cache and History, and tried in incogntio window too, above is the key code snippet – Kumar_diru Mar 3 '17 at 10:36
0

Below Snippet gives me changes in Component on component View

var itemDisplayTest=$display.getItem();
itemDisplayTest.collectData();
itemDisplayTest.getContentSection();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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