zirbel
zirbel

Reputation: 400

How to get Title/text from Microsoft Dynamics 2011 subject

I want to check the name of a global subject. It tried it with getText(), getName() and other methods from here.

Isn't it an attribute?

function CheckSubject()
{
  var texter = Xrm.Page.getAttribute("subjectid").getValue();

  alert(texter);  // output: [object Object]
  alert(texter.getText());  // output:  Fehler im benutzerdefinierten Ereignis dieses Felds. Feld:subjectid Ereignis:onchange Fehler:undefined

  if(texter=="Incident")
  {
    // DO something
  }
}

Best

Upvotes: 0

Views: 969

Answers (1)

Pedro Azevedo
Pedro Azevedo

Reputation: 2507

The subjectid return a lookup object. You this options in a lookup object:

var name = texter[0].name;
var guid = texter[0].id;
var entType = texter[0].entityType;

Upvotes: 1

Related Questions