Answered by:
Get all the Teams a User is a member of

Question
-
Hi guys,
Does anyone have the javascript to enable me to get all the teams that a user belongs too.
Ideally I need to put it on load of a form and the code provides me with a string/list of the team names that the user is a member of.
Thanks in advance
Friday, June 17, 2011 10:00 AM
Answers
-
Hello Bharat,
Following script will allow you to have all ids and names in arrays:
var xml = "" + "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" + GenerateAuthenticationHeader() + " <soap:Body>" + " <RetrieveMultiple xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" + " <query xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:QueryExpression\">" + " <q1:EntityName>team</q1:EntityName>" + " <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" + " <q1:Attributes>" + " <q1:Attribute>name</q1:Attribute>" + " </q1:Attributes>" + " </q1:ColumnSet>" + " <q1:Distinct>false</q1:Distinct>" + " <q1:LinkEntities>" + " <q1:LinkEntity>" + " <q1:LinkFromAttributeName>teamid</q1:LinkFromAttributeName>" + " <q1:LinkFromEntityName>team</q1:LinkFromEntityName>" + " <q1:LinkToEntityName>teammembership</q1:LinkToEntityName>" + " <q1:LinkToAttributeName>teamid</q1:LinkToAttributeName>" + " <q1:JoinOperator>Inner</q1:JoinOperator>" + " <q1:LinkCriteria>" + " <q1:FilterOperator>And</q1:FilterOperator>" + " <q1:Conditions>" + " <q1:Condition>" + " <q1:AttributeName>systemuserid</q1:AttributeName>" + " <q1:Operator>EqualUserId</q1:Operator>" + " </q1:Condition>" + " </q1:Conditions>" + " </q1:LinkCriteria>" + " </q1:LinkEntity>" + " </q1:LinkEntities>" + " </query>" + " </RetrieveMultiple>" + " </soap:Body>" + "</soap:Envelope>" + ""; var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP"); xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false); xmlHttpRequest.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple"); xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xmlHttpRequest.setRequestHeader("Content-Length", xml.length); xmlHttpRequest.send(xml); var resultXml = xmlHttpRequest.responseXML; //alert(resultXml.xml); // Save all entity nodes in an array. var entityNodes = resultXml.selectNodes("//RetrieveMultipleResult/BusinessEntities/BusinessEntity"); var teamnames = new Array(); var teamids = new Array(); for (var i = 0; i < entityNodes.length; i++) { var entityNode = entityNodes[i]; var teamidNode = entityNode.selectSingleNode("q1:teamid"); var teamNode = entityNode.selectSingleNode("q1:name"); var teamid = (teamidNode == null) ? null : teamidNode.text; var team = (teamNode == null) ? null : teamNode.text; teamnames[i] = team; teamids[i] = teamid; }
Microsoft CRM Freelancer
My blog (english)
Мой блог (русскоязычный)
- Proposed as answer by Andrii ButenkoMVP, Moderator Friday, June 17, 2011 2:52 PM
- Marked as answer by BharatP Friday, June 17, 2011 3:01 PM
Friday, June 17, 2011 2:51 PMModerator -
use this code
function teamcheck (){
debugger;
var lookup = crmForm.all.ownerid.DataValue;
var OwnerID;
var OwnerName;
if (lookup != null && lookup[0] != null) {
OwnerName = lookup[0].name;
OwnerID = lookup[0].id;
}
var xml = "" +
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
GenerateAuthenticationHeader() +
" <soap:Body>" +
" <RetrieveMultiple xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
" <query xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:QueryExpression\">" +
" <q1:EntityName>team</q1:EntityName>" +
" <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" +
" <q1:Attributes>" +
" <q1:Attribute>name</q1:Attribute>" +
" </q1:Attributes>" +
" </q1:ColumnSet>" +
" <q1:Distinct>false</q1:Distinct>" +
" <q1:LinkEntities>" +
" <q1:LinkEntity>" +
" <q1:LinkFromAttributeName>teamid</q1:LinkFromAttributeName>" +
" <q1:LinkFromEntityName>team</q1:LinkFromEntityName>" +
" <q1:LinkToEntityName>teammembership</q1:LinkToEntityName>" +
" <q1:LinkToAttributeName>teamid</q1:LinkToAttributeName>" +
" <q1:JoinOperator>Inner</q1:JoinOperator>" +
" <q1:LinkCriteria>" +
" <q1:FilterOperator>And</q1:FilterOperator>" +
" <q1:Conditions>" +
" <q1:Condition>" +
" <q1:AttributeName>systemuserid</q1:AttributeName>" +
" <q1:Operator>Equal</q1:Operator>" +
"<q1:Values>" +
//code to get the owner
"<q1:Value xsi:type=\"xsd:string\">" + OwnerID + "</q1:Value>" +
"</q1:Values>" +
" </q1:Condition>" +
" </q1:Conditions>" +
" </q1:LinkCriteria>" +
" </q1:LinkEntity>" +
" </q1:LinkEntities>" +
" </query>" +
" </RetrieveMultiple>" +
" </soap:Body>" +
"</soap:Envelope>" +
"";
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
xmlHttpRequest.send(xml);
var resultXml = xmlHttpRequest.responseXML;
//alert(resultXml.xml);
// Save all entity nodes in an array.
var entityNodes = resultXml.selectNodes("//RetrieveMultipleResult/BusinessEntities/BusinessEntity");
var teamnames = new Array();
var teamids = new Array();
for (var i = 0; i < entityNodes.length; i++) {
var entityNode = entityNodes[i];
var teamidNode = entityNode.selectSingleNode("q1:teamid");
var teamNode = entityNode.selectSingleNode("q1:name");
var teamid = (teamidNode == null) ? null : teamidNode.text;
var team = (teamNode == null) ? null : teamNode.text;
teamnames[i] = team;
teamids[i] = teamid;
}
alert(teamnames);
}Tuesday, June 26, 2012 9:41 AM -
Hi Bharat,
This script is from the same link that i have mentioned in my earlier http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/4c7289c0-16b0-4a44-9323-d67f7c775c6d
Jehanzeb Javeed
http://worldofdynamics.blogspot.com
Linked-In Profile |CodePlex Profile
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
- Marked as answer by BharatP Friday, June 17, 2011 3:11 PM
Friday, June 17, 2011 3:06 PM
All replies
-
It would be a retrieve multiple or a retrieve request depending on how you want to do it. You can probably get it to work from one of these two posts by changing around some attribute and entity names.
http://mileyja.blogspot.com/2011/04/how-to-use-retrieve-messages-in-jscript.html
http://mileyja.blogspot.com/2011/03/crm-2011-retrievemultiple-calls-in.html
Jamie Miley
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!- Proposed as answer by Jamie MileyModerator Friday, June 17, 2011 1:32 PM
Friday, June 17, 2011 1:32 PMModerator -
It would be a retrieve multiple or a retrieve request depending on how you want to do it. You can probably get it to work from one of these two posts by changing around some attribute and entity names.
http://mileyja.blogspot.com/2011/04/how-to-use-retrieve-messages-in-jscript.html
http://mileyja.blogspot.com/2011/03/crm-2011-retrievemultiple-calls-in.html
Jamie Miley
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!
I should have mentioned in using CRM 4.0...will these links with with that version?Friday, June 17, 2011 1:42 PM -
Hi,
You can use the JScript code mentioned in the following post http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/4c7289c0-16b0-4a44-9323-d67f7c775c6d
I hope this will be helpful.
Jehanzeb Javeed
http://worldofdynamics.blogspot.com
Linked-In Profile |CodePlex Profile
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".- Proposed as answer by Jehanzeb.Javeed Friday, June 17, 2011 2:06 PM
- Marked as answer by Andrii ButenkoMVP, Moderator Friday, June 17, 2011 3:11 PM
- Unmarked as answer by Andrii ButenkoMVP, Moderator Friday, June 17, 2011 3:26 PM
Friday, June 17, 2011 2:06 PM -
Hi,
You can use the JScript code mentioned in the following post http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/4c7289c0-16b0-4a44-9323-d67f7c775c6d
I hope this will be helpful.
Jehanzeb Javeed
http://worldofdynamics.blogspot.com
Linked-In Profile |CodePlex Profile
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
Hi Jehanzeb,That seems to work but not if a user is a member of 2 or more teams, it only brings back the first one, anyway of bringing back all the teams?
Friday, June 17, 2011 2:16 PM -
Hello Bharat,
Following script will allow you to have all ids and names in arrays:
var xml = "" + "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" + GenerateAuthenticationHeader() + " <soap:Body>" + " <RetrieveMultiple xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" + " <query xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:QueryExpression\">" + " <q1:EntityName>team</q1:EntityName>" + " <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" + " <q1:Attributes>" + " <q1:Attribute>name</q1:Attribute>" + " </q1:Attributes>" + " </q1:ColumnSet>" + " <q1:Distinct>false</q1:Distinct>" + " <q1:LinkEntities>" + " <q1:LinkEntity>" + " <q1:LinkFromAttributeName>teamid</q1:LinkFromAttributeName>" + " <q1:LinkFromEntityName>team</q1:LinkFromEntityName>" + " <q1:LinkToEntityName>teammembership</q1:LinkToEntityName>" + " <q1:LinkToAttributeName>teamid</q1:LinkToAttributeName>" + " <q1:JoinOperator>Inner</q1:JoinOperator>" + " <q1:LinkCriteria>" + " <q1:FilterOperator>And</q1:FilterOperator>" + " <q1:Conditions>" + " <q1:Condition>" + " <q1:AttributeName>systemuserid</q1:AttributeName>" + " <q1:Operator>EqualUserId</q1:Operator>" + " </q1:Condition>" + " </q1:Conditions>" + " </q1:LinkCriteria>" + " </q1:LinkEntity>" + " </q1:LinkEntities>" + " </query>" + " </RetrieveMultiple>" + " </soap:Body>" + "</soap:Envelope>" + ""; var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP"); xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false); xmlHttpRequest.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple"); xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xmlHttpRequest.setRequestHeader("Content-Length", xml.length); xmlHttpRequest.send(xml); var resultXml = xmlHttpRequest.responseXML; //alert(resultXml.xml); // Save all entity nodes in an array. var entityNodes = resultXml.selectNodes("//RetrieveMultipleResult/BusinessEntities/BusinessEntity"); var teamnames = new Array(); var teamids = new Array(); for (var i = 0; i < entityNodes.length; i++) { var entityNode = entityNodes[i]; var teamidNode = entityNode.selectSingleNode("q1:teamid"); var teamNode = entityNode.selectSingleNode("q1:name"); var teamid = (teamidNode == null) ? null : teamidNode.text; var team = (teamNode == null) ? null : teamNode.text; teamnames[i] = team; teamids[i] = teamid; }
Microsoft CRM Freelancer
My blog (english)
Мой блог (русскоязычный)
- Proposed as answer by Andrii ButenkoMVP, Moderator Friday, June 17, 2011 2:52 PM
- Marked as answer by BharatP Friday, June 17, 2011 3:01 PM
Friday, June 17, 2011 2:51 PMModerator -
Andriy,
Thank you very much, works perfectly.....much appreciated
Friday, June 17, 2011 3:01 PM -
Hi Bharat,
This script is from the same link that i have mentioned in my earlier http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/4c7289c0-16b0-4a44-9323-d67f7c775c6d
Jehanzeb Javeed
http://worldofdynamics.blogspot.com
Linked-In Profile |CodePlex Profile
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
- Marked as answer by BharatP Friday, June 17, 2011 3:11 PM
Friday, June 17, 2011 3:06 PM -
Hi Bharat,
This script is from the same link that i have mentioned in my earlier http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/4c7289c0-16b0-4a44-9323-d67f7c775c6d
Jehanzeb Javeed
http://worldofdynamics.blogspot.com
Linked-In Profile |CodePlex Profile
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
One last question....can I replace:" <q1:Operator>EqualUserId</q1:Operator>" +
so I can pick up a value from the form rather than the user logged in?
Im assuming this is where its picking up the current user logged in.
Bharat
Friday, June 17, 2011 3:26 PM -
Hi,
To get current user Id you have to call WhoAmI JScript request as mentioned in the following posts:
http://rami-heleg.blogspot.com/2009/04/my-test.html
Jehanzeb Javeed
http://worldofdynamics.blogspot.com
Linked-In Profile |CodePlex Profile
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".Friday, June 17, 2011 3:42 PM -
Hi,
To get current user Id you have to call WhoAmI JScript request as mentioned in the following posts:
http://rami-heleg.blogspot.com/2009/04/my-test.html
Jehanzeb Javeed
http://worldofdynamics.blogspot.com
Linked-In Profile |CodePlex Profile
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
Hi Jehanzeb,I dont need the current user logged in, I am looking to take the value off the form: so Id be replacing:
" <q1:Operator>EqualUserId</q1:Operator>" +
with something like
" <q1:Operator>crmForm.all.ownerid.DataValue[0].id/q1:Operator>" +
I have tried:
" <q1:AttributeName>systemuserid</q1:AttributeName>" +
" <q1:Operator>Equal</q1:Operator>" +
" <q1:Values>" +
" <q1/Value>crmForm.all.ownerid.DataValue[0].id</q1:Value>" +
" </q1:Values>" +but that doesnt seem to work....
any ideas?
Friday, June 17, 2011 4:25 PM -
Hi Bharat,
You need to correct the code statement like this:
" <q1/Value>" + crmForm.all.ownerid.DataValue[0].id + "</q1:Value>" +
Jehanzeb Javeed
http://worldofdynamics.blogspot.com
Linked-In Profile |CodePlex Profile
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".- Proposed as answer by Jehanzeb.Javeed Friday, June 17, 2011 4:29 PM
Friday, June 17, 2011 4:29 PM -
Hi Bharat,
You need to correct the code statement like this:
" <q1/Value>" + crmForm.all.ownerid.DataValue[0].id + "</q1:Value>" +
Jehanzeb Javeed
http://worldofdynamics.blogspot.com
Linked-In Profile |CodePlex Profile
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
Hi Jehanzeb,I have tried what you suggested but still cant get it to work, then second alert I set up doesnt bring back any values the first alert brings back the correct GUID, can you see where I have gone wrong?
var leadsales = crmForm.all.ownerid.DataValue[0].id;
alert (leadsales);
var xml = "" +
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
GenerateAuthenticationHeader() +
" <soap:Body>" +
" <RetrieveMultiple xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
" <query xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:QueryExpression\">" +
" <q1:EntityName>team</q1:EntityName>" +
" <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" +
" <q1:Attributes>" +
" <q1:Attribute>name</q1:Attribute>" +
" </q1:Attributes>" +
" </q1:ColumnSet>" +
" <q1:Distinct>false</q1:Distinct>" +
" <q1:LinkEntities>" +
" <q1:LinkEntity>" +
" <q1:LinkFromAttributeName>teamid</q1:LinkFromAttributeName>" +
" <q1:LinkFromEntityName>team</q1:LinkFromEntityName>" +
" <q1:LinkToEntityName>teammembership</q1:LinkToEntityName>" +
" <q1:LinkToAttributeName>teamid</q1:LinkToAttributeName>" +
" <q1:JoinOperator>Inner</q1:JoinOperator>" +
" <q1:LinkCriteria>" +
" <q1:FilterOperator>And</q1:FilterOperator>" +
" <q1:Conditions>" +
" <q1:Condition>" +
" <q1:AttributeName>systemuserid</q1:AttributeName>" +
" <q1:Operator>Equal</q1:Operator>" +
" <q1:Values>" +
" <q1/Value>" + leadsales + "</q1:Value>" +
" </q1:Condition>" +
" </q1:Conditions>" +
" </q1:LinkCriteria>" +
" </q1:LinkEntity>" +
" </q1:LinkEntities>" +
" </query>" +
" </RetrieveMultiple>" +
" </soap:Body>" +
"</soap:Envelope>" +
"";
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
xmlHttpRequest.send(xml);
var resultXml = xmlHttpRequest.responseXML;
//alert(resultXml.xml);// Save all entity nodes in an array.
var entityNodes = resultXml.selectNodes("//RetrieveMultipleResult/BusinessEntities/BusinessEntity");var teamnames = new Array();
var teamids = new Array();for (var i = 0; i < entityNodes.length; i++)
{
var entityNode = entityNodes[i];
var teamidNode = entityNode.selectSingleNode("q1:teamid");
var teamNode = entityNode.selectSingleNode("q1:name");
var teamid = (teamidNode == null) ? null : teamidNode.text;
var team = (teamNode == null) ? null : teamNode.text;teamnames[i] = team;
teamids[i] = teamid;
}alert (teamnames)
- Edited by BharatP Friday, June 17, 2011 6:16 PM typos
Friday, June 17, 2011 5:56 PM -
use this code
function teamcheck (){
debugger;
var lookup = crmForm.all.ownerid.DataValue;
var OwnerID;
var OwnerName;
if (lookup != null && lookup[0] != null) {
OwnerName = lookup[0].name;
OwnerID = lookup[0].id;
}
var xml = "" +
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
GenerateAuthenticationHeader() +
" <soap:Body>" +
" <RetrieveMultiple xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
" <query xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:QueryExpression\">" +
" <q1:EntityName>team</q1:EntityName>" +
" <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" +
" <q1:Attributes>" +
" <q1:Attribute>name</q1:Attribute>" +
" </q1:Attributes>" +
" </q1:ColumnSet>" +
" <q1:Distinct>false</q1:Distinct>" +
" <q1:LinkEntities>" +
" <q1:LinkEntity>" +
" <q1:LinkFromAttributeName>teamid</q1:LinkFromAttributeName>" +
" <q1:LinkFromEntityName>team</q1:LinkFromEntityName>" +
" <q1:LinkToEntityName>teammembership</q1:LinkToEntityName>" +
" <q1:LinkToAttributeName>teamid</q1:LinkToAttributeName>" +
" <q1:JoinOperator>Inner</q1:JoinOperator>" +
" <q1:LinkCriteria>" +
" <q1:FilterOperator>And</q1:FilterOperator>" +
" <q1:Conditions>" +
" <q1:Condition>" +
" <q1:AttributeName>systemuserid</q1:AttributeName>" +
" <q1:Operator>Equal</q1:Operator>" +
"<q1:Values>" +
//code to get the owner
"<q1:Value xsi:type=\"xsd:string\">" + OwnerID + "</q1:Value>" +
"</q1:Values>" +
" </q1:Condition>" +
" </q1:Conditions>" +
" </q1:LinkCriteria>" +
" </q1:LinkEntity>" +
" </q1:LinkEntities>" +
" </query>" +
" </RetrieveMultiple>" +
" </soap:Body>" +
"</soap:Envelope>" +
"";
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
xmlHttpRequest.send(xml);
var resultXml = xmlHttpRequest.responseXML;
//alert(resultXml.xml);
// Save all entity nodes in an array.
var entityNodes = resultXml.selectNodes("//RetrieveMultipleResult/BusinessEntities/BusinessEntity");
var teamnames = new Array();
var teamids = new Array();
for (var i = 0; i < entityNodes.length; i++) {
var entityNode = entityNodes[i];
var teamidNode = entityNode.selectSingleNode("q1:teamid");
var teamNode = entityNode.selectSingleNode("q1:name");
var teamid = (teamidNode == null) ? null : teamidNode.text;
var team = (teamNode == null) ? null : teamNode.text;
teamnames[i] = team;
teamids[i] = teamid;
}
alert(teamnames);
}Tuesday, June 26, 2012 9:41 AM -
This was exactly what I needed. Thank you for posting this!Thursday, September 6, 2012 4:41 AM