I would like to use the $models object while hacking javascript in the Google Chrome Console .

For example, I would like a 1 line sample of how to get the $models object and then be able to : $models.getItem("tcm:1-42")

  • sorry robrtc, unable to understand the question. if you execute above line directly in chrome console, it works fine.
    – Raj Kumar
    Dec 19 '14 at 6:55
  • I get this error: ReferenceError: $models is not defined. I want to be able to load the selected item in the GUI into an object.
    – robrtc
    Dec 19 '14 at 6:58
  • $models works fine for me in Tridion 2011SP1 env and shows following Object {getOwningWindow: function, getModelFactory: function, getItem: function, createNewItem: function, getItemType: function…}
    – Raj Kumar
    Dec 19 '14 at 7:01
  • Maybe changed in 2013SP1 with the new Anguilla updates?
    – robrtc
    Dec 19 '14 at 7:07

You need to ensure that you have first selected the correct frame in the console. It defaults to 'top frame' but you'll want to choose e.g. Dashboard.aspx. You'll know it's the right one when it helps you with code completion :)

Correct frame selected

  • Thanks Peter...the hack-ish way to get it in Chrome is window.top.frames[1].$models...
    – robrtc
    Dec 19 '14 at 9:40
  • Very helpful, I was turning crazy trying to get the user in the tridion 2013 dashboard, using the js console in chrome. Apr 22 '15 at 9:03

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.