Link to home
Start Free TrialLog in
Avatar of bronafon_ict
bronafon_ict

asked on

Retrieving Parent Subject from Dynamics subject tree

Hi all

I am using subject trees in Microsoft Dynamics CRM, is there a way of retrieving the parent subject of a selected node.

I managed to grab this code off the net which populates the value but cant determine the parent subject, just wondering if there is a property which holds this information that I am missing.

var lookupItem = new Array;

// This gets the lookup for the attribute new_phonesubjectid on the Phone Call form.
lookupItem = crmForm.all.new_phonesubjectid.DataValue;

// If there is data in the field, show it in a series of alerts.
if (lookupItem[0] != null)
{
   // The text value of the lookup. Set the subject line of the Phone call to this value
  // alert(lookupItem[0].name);
      crmForm.all.subject.DataValue=lookupItem[0].name;

   // The GUID of the lookup.
   alert(lookupItem[0].id);

   // The entity type name.
   alert(lookupItem[0].typename);

}

Avatar of Gurvinder Pal Singh
Gurvinder Pal Singh
Flag of India image

using javascript, if you want to get the parent of an element then you need to use element.parentNode

check this here
http://www.w3schools.com/jsref/dom_obj_all.asp
Hi bronafon_ict, 
You will have to query CRM using XmlHttp call to get the parent, When you get subject in the lookup 
Regards,
Chinmay

ASKER CERTIFIED SOLUTION
Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bronafon_ict
bronafon_ict

ASKER

Hi Chinmay

Thanks for the explanation on this one, in a bid to try and recycle some infomation back I found this thread very useful which gave me what I needed, following on from the solution you gave me.

http://www.go4answers.com/Example/retrieve-selected-child-parent-item-120064.aspx

:-)


Oh these are screen scrapping sites. They steal information from legit sites. The article you are looking at is ripped from Social.msdn.com :)
Anyways... Thanks this will come handy someday.