- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2014 01:31 PM
I am setting up an integration with Workday.
I am making a soap call from a business rule, in which it returns XML in the response. This response (wd:Get_Workers_Response) contains about 1000 records which I would like to separate out by user (Worker), which will create a new record in our instance per user. When I convert the XML to an object, how do I access that node (if I am asking that correctly)? The node I am trying to access is <wd:Response_Data>. Under that, each worker is <wd:Worker>.
This script doesn't work for me
var s = new SOAPMessage('WorkdayIntegration', 'Get_Workers'); s.setStringParameter('Effective_Through', '2014-09-30T00:00:00'); s.setStringParameter('Effective_From', '2014-09-01T00:00:00'); s.setStringParameter('version', 'v21.0'); s.setStringParameter('Updated_From', '2014-09-01T00:00:00'); s.setStringParameter('type', 'Employee_ID'); s.setStringParameter('Updated_Through', '2014-09-30T00:00:00'); s.setStringParameter('Exclude_Inactive_Workers', 'true'); var response = s.post(true); var xmlHelp = new XMLHelper(response); var obj = xmlHelp.toObject(); JSUtil.logObject(obj, 'The Javascript Object'); var test3 = obj.getNodeText("//*[local-name()='wd:Worker']");
Solved! Go to Solution.
- Labels:
-
Ask the Expert

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2014 04:05 PM
Hi Monroe,
Try something like the following. It basically branches its way down the response tree until it gets to the 'wd:Name_Detail_Data' object which contains properties for first, middle and last name etc. You may need to reformat the tabbing as the syntax highlighter has modified mine.
var obj = xmlHelp.toObject(); // get entire response as object
if(obj){
var env_body = obj['env:Body']; // get object in first tier
if(env_body){
var wd_get_workers_response = env_body['wd:Get_Workers_Response']; // get object from first tier
if(wd_get_workers_response){
var wd_response_data = wd_get_workers_response['wd:Response_Data'];
if(wd_response_data){
var wd_worker_arr = wd_response_data['wd:Worker'];
if(wd_worker_arr){
for(var i=0;i<wd_worker_arr.length;i++){ // this will loop for all instances of the "wd:Worker" element. You may need to modify this to check for non-array though as the structure for a single element would be different
var wd_worker = wd_worker_arr[i]; // get current worker element in array
if(wd_worker){
var worker_data = wd_worker['wd:Worker_Data'];
if(worker_data){
var wd_personal_data = worker_data['wd:Personal_Data'];
if(wd_personal_data){
var wd_name_data = wd_personal_data['wd:Name_Data'];
if(wd_name_data){
var wd_legal_name_data = wd_name_data['wd:Legal_Name_Data'];
if(wd_legal_name_data){
var wd_name_detail_data = wd_legal_name_data['wd:Name_Detail_Data'];
if(wd_name_detail_data){
// get string values from object
var first_name = wd_name_detail_data['wd:First_Name'];
var middle_name = wd_name_detail_data['wd:Middle_Name'];
var last_name = wd_name_detail_data['wd:Last_Name'];
}
}
}
}
}
}
}
}
}
}
}
}
Regards,
Jake

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2014 06:05 AM
Hi Monroe,
When you convert the XML response to an object, you can navigate down the tree by accessing each node in a parent-child relationship. Because of the special characters in your XML element names (e.g ":"), you need to use bracket notation and declare each level as you go down the tree. Each time you do this you should check that the element actually exists before proceeding further down the tree (to avoid JS errors).
Without knowing all of your XML response, it may look something like this:
var obj = xmlHelp.toObject(); // get entire response as object
if(obj){
var wd_response_data = obj['wd:Response_Data']; // get object in first tier
if(wd_response_data){
var wd_worker = wd_response_data['wd:Worker']; // get object from first tier
if(wd_worker){
var myValue = wd_worker.value_field; // get string value from property of wd_worker
}
}
}
If you paste the first few lines of your XML response (at least up to the node you wish to access) I might be able to assist further.
Regards,
Jake
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2014 07:44 AM
Thanks Jake.
Here is a copy of the XML response as an object, only for the first user. In this particular object there are about 1000 users. There is a lot of data in here that I won't be using. Line 199 is one of the objects I am trying to get. First Name, Last Name, for example.
Log Object: The Javascript Object
Object
env:Body: Object
wd:Get_Workers_Response: Object
wd:Request_Criteria: Object
wd:Transaction_Log_Criteria_Data: Object
wd:Transaction_Date_Range_Data: Object
wd:Updated_Through: string = 2014-09-30T00:00:00.000-07:00
wd:Updated_From: string = 2014-09-01T00:00:00.000-07:00
wd:Effective_Through: string = 2014-09-30T00:00:00.000-07:00
wd:Effective_From: string = 2014-09-01T00:00:00.000-07:00
wd:Exclude_Inactive_Workers: string = 1
wd:Response_Data: Object
wd:Worker: Array of 100 elements
[0]: Object
wd:Worker_Data: Object
wd:User_ID: string = 000000
wd:Personal_Data: Object
wd:Tobacco_Use: string = 0
wd:Contact_Data: Object
wd:Email_Address_Data: Object
wd:Usage_Data: Object
wd:Type_Data: Object
@wd:Primary: string = 1
wd:Type_Reference: Object
@wd:Descriptor: string = Work
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 123456789101112abcdefghi
[1]: Object
@wd:type: string = Communication_Usage_Type_ID
#text: string = WORK
@wd:Public: string = 1
wd:Email_Address: string = xxxxxx@centene.com
wd:Address_Data: Array of 2 elements
[0]: Object
@wd:Effective_Date: string = 1900-01-01-08:00
wd:Postal_Code: string = 12345
wd:Country_Reference: Object
@wd:Descriptor: string = United States of America
wd:ID: Array of 4 elements
[0]: Object
@wd:type: string = WID
#text: string = ab1234567891011abcdefg
[1]: Object
@wd:type: string = xxxx-xxxxxxx-xxxxx-xx
#text: string = US
[2]: Object
@wd:type: string = xxxx-xxxxxxx-xxxxx-xx
#text: string = USA
[3]: Object
@wd:type: string = xxxx-xxxxxxx-xxxxx-xx
#text: string = 840
wd:Usage_Data: Object
wd:Type_Data: Object
@wd:Primary: string = 1
wd:Type_Reference: Object
@wd:Descriptor: string = Work
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 123456789101112131451617181920
[1]: Object
@wd:type: string = Communication_Usage_Type_ID
#text: string = WORK
@wd:Public: string = 1
@wd:Address_Format_Type: string = Basic
wd:Municipality: string = New York
wd:Last_Modified: string = 2014-04-04T10:15:57.223-07:00
wd:Address_Reference: Object
@wd:Descriptor: string = ADDRESS_REFERENCE-6-37
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 123456789101112131415161718
[1]: Object
@wd:type: string = Address_ID
#text: string = ADDRESS_REFERENCE-6-37
wd:Country_Region_Reference: Object
@wd:Descriptor: string = New York
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 10afdafda5412345da54f85468dafd
[1]: Object
@wd:type: string = Country_Region_ID
#text: string = USA-NY
@wd:Defaulted_Business_Site_Address: string = 1
@wd:Formatted_Address: string = 123 Main st;St Louis;MO
wd:Address_Line_Data: Array of 2 elements
[0]: Object
#text: string = 123 Main St
@wd:Descriptor: string = Address Line 1
@wd:Type: string = ADDRESS_LINE_1
[1]: Object
#text: string = Suite 200
@wd:Descriptor: string = Address Line 2
@wd:Type: string = ADDRESS_LINE_2
[1]: Object
@wd:Effective_Date: string = 2004-03-13-08:00
wd:Postal_Code: string = 12345
wd:Country_Reference: Object
@wd:Descriptor: string = United States of America
wd:ID: Array of 4 elements
[0]: Object
@wd:type: string = WID
#text: string = fdafdafdaf5dasfdafd545ad4fad54asdf
[1]: Object
@wd:type: string = xxxx-xxxxxxx-xxxxx-xx
#text: string = US
[2]: Object
@wd:type: string = xxxx-xxxxxxx-xxxxx-xx
#text: string = USA
[3]: Object
@wd:type: string = xxxx-xxxxxxx-xxxxx-xx
#text: string = 840
wd:Usage_Data: Object
wd:Use_For_Reference: Object
@wd:Descriptor: string = Mailing
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 54656812458494534684
[1]: Object
@wd:type: string = Communication_Usage_Behavior_ID
#text: string = MAILING
wd:Type_Data: Object
@wd:Primary: string = 1
wd:Type_Reference: Object
@wd:Descriptor: string = Home
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 3158486489546894654
[1]: Object
@wd:type: string = Communication_Usage_Type_ID
#text: string = HOME
@wd:Public: string = 0
@wd:Address_Format_Type: string = Basic
wd:Municipality: string = New York
wd:Last_Modified: string = 2014-04-15T20:54:54.873-07:00
wd:Address_Reference: Object
@wd:Descriptor: string = ADDRESS_REFERENCE-6-6593
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 54654816484964846549849469846
[1]: Object
@wd:type: string = Address_ID
#text: string = xxxx-xxxxxxx-xxxxx-xx
wd:Country_Region_Reference: Object
@wd:Descriptor: string = New York
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 65465465465484654654
[1]: Object
@wd:type: string = Country_Region_ID
#text: string = USA-NY
@wd:Defaulted_Business_Site_Address: string = 0
@wd:Formatted_Address: string = address;city;state;zip
wd:Address_Line_Data: Array of 2 elements
[0]: Object
#text: string = 123Main
@wd:Descriptor: string = 12main
@wd:Type: string = ADDRESS_LINE_1
[1]: Object
#text: string = 7857
@wd:Descriptor: string = Address Line 2
@wd:Type: string = ADDRESS_LINE_2
wd:Phone_Data: Object
wd:Phone_Device_Type_Reference: Object
@wd:Descriptor: string = Telephone
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 1232156465456464
[1]: Object
@wd:type: string = Phone_Device_Type_ID
#text: string = Telephone
wd:International_Phone_Code: string = 1
wd:Country_ISO_Code: string = USA
wd:Area_Code: string = 585
wd:Phone_Number: string = 777-7777
wd:Usage_Data: Object
wd:Type_Data: Object
@wd:Primary: string = 1
wd:Type_Reference: Object
@wd:Descriptor: string = Home
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 546542319846315
[1]: Object
@wd:type: string = Communication_Usage_Type_ID
#text: string = HOME
@wd:Public: string = 0
@wd:Formatted_Phone: string = 5454645645
wd:Name_Data: Object
wd:Legal_Name_Data: Object
wd:Name_Detail_Data: Object
wd:Middle_Name: string = S
wd:First_Name: string = Jane
@wd:Formatted_Name: string = Jane Doe
@wd:Reporting_Name: string = Doe, Jane S
wd:Last_Name: string = Doe
wd:Country_Reference: Object
@wd:Descriptor: string = United States of America
wd:ID: Array of 4 elements
[0]: Object
@wd:type: string = WID
#text: string = 21321654894654684
[1]: Object
@wd:type: string = xxxx-xxxxxxx-xxxxx-xx
#text: string = US
[2]: Object
@wd:type: string = xxxx-xxxxxxx-xxxxx-xx
#text: string = USA
[3]: Object
@wd:type: string = xxxx-xxxxxxx-xxxxx-xx
#text: string = 840
wd:Preferred_Name_Data: Object
wd:Name_Detail_Data: Object
wd:Middle_Name: string = S
wd:First_Name: string = Jane
@wd:Formatted_Name: string = Jane Doe
@wd:Reporting_Name: string = Doe, Jane S
wd:Last_Name: string = Doe
wd:Country_Reference: Object
@wd:Descriptor: string = United States of America
wd:ID: Array of 4 elements
[0]: Object
@wd:type: string = WID
#text: string = 6546465465468465468
[1]: Object
@wd:type: string = xxxx-xxxxxxx-xxxxx-xx
#text: string = US
[2]: Object
@wd:type: string = xxxx-xxxxxxx-xxxxx-xx
#text: string = USA
[3]: Object
@wd:type: string = xxxx-xxxxxxx-xxxxx-xx
#text: string = 840
wd:Employment_Data: Object
wd:Worker_Status_Data: Object
wd:Days_Unemployed: string = 0
wd:Hire_Reason_Reference: Object
@wd:Descriptor: string = Hire Employee > Hire Employee > New Hire
wd:ID: Array of 3 elements
[0]: Object
@wd:type: string = WID
#text: string = 123456789
[1]: Object
@wd:type: string = Event_Classification_Subcategory_ID
#text: string = Hire_Employee_Hire_Employee_New_Hire
[2]: Object
@wd:type: string = General_Event_Subcategory_ID
#text: string = Hire_Employee_Hire_Employee_New_Hire
wd:Rehire: string = 0
wd:Continuous_Service_Date: string = 2004-03-12-08:00
wd:Active_Status_Date: string = 2004-03-12-08:00
wd:Benefits_Service_Date: string = 2004-03-12-08:00
wd:First_Day_of_Work: string = 2004-03-12-08:00
wd:Not_Returning: string = 0
wd:Months_Continuous_Prior_Employment: string = 0
wd:Seniority_Date: string = 2004-03-12-08:00
wd:Terminated: string = 0
wd:Retired: string = 0
wd:Return_Unknown: string = 0
wd:Active: string = 1
wd:Hire_Date: string = 2004-03-12-08:00
wd:Original_Hire_Date: string = 2004-03-12-08:00
wd:Regrettable_Termination: string = 0
wd:Not_Eligible_for_Hire: string = 0
wd:Position_Data: Object
wd:Business_Site_Summary_Data: Object
wd:Local_Reference: Object
@wd:Descriptor: string = English (United States) - en_US
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 151321564648978
[1]: Object
@wd:type: string = Locale_ID
#text: string = en_US
wd:Time_Profile_Reference: Object
@wd:Descriptor: string = Standard Hours - 40
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 546546847984654849684
[1]: Object
@wd:type: string = Time_Profile_ID
#text: string = Standard_Hours_40
wd:Scheduled_Weekly_Hours: string = 40
wd:Name: string = New York - 123 Main
wd:Address_Data: Object
@wd:Effective_Date: string = 1900-01-01-08:00
wd:Postal_Code: string = 10022
wd:Country_Reference: Object
@wd:Descriptor: string = United States of America
wd:ID: Array of 4 elements
[0]: Object
@wd:type: string = WID
#text: string = 546542135498
[1]: Object
@wd:type: string = xxxx-xxxxxxx-xxxxx-xx
#text: string = US
[2]: Object
@wd:type: string = xxxx-xxxxxxx-xxxxx-xx
#text: string = USA
[3]: Object
@wd:type: string = xxxx-xxxxxxx-xxxxx-xx
#text: string = 840
wd:Usage_Data: Object
wd:Use_For_Reference: Array of 2 elements
[0]: Object
@wd:Descriptor: string = Billing
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = ljlkjfdlkjafaoijodaij
[1]: Object
@wd:type: string = Communication_Usage_Behavior_ID
#text: string = BILLING
[1]: Object
@wd:Descriptor: string = Remit To
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 512316546847654
[1]: Object
@wd:type: string = Communication_Usage_Behavior_ID
#text: string = REMIT
wd:Type_Data: Object
@wd:Primary: string = 1
wd:Type_Reference: Object
@wd:Descriptor: string = Business
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 1156465465461351465
[1]: Object
@wd:type: string = Communication_Usage_Type_ID
#text: string = BUSINESS
@wd:Public: string = 1
@wd:Address_Format_Type: string = Basic
wd:Municipality: string = New York
wd:Last_Modified: string = 2014-04-04T10:15:57.223-07:00
wd:Address_Reference: Object
@wd:Descriptor: string = ADDRESS_REFERENCE-6-37
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 35456465132456
[1]: Object
@wd:type: string = Address_ID
#text: string = ADDRESS_REFERENCE-6-37
wd:Country_Region_Reference: Object
@wd:Descriptor: string = New York
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 56465131456412
[1]: Object
@wd:type: string = Country_Region_ID
#text: string = USA-NY
@wd:Defaulted_Business_Site_Address: string = 0
@wd:Formatted_Address: string = 123 Main
wd:Address_Line_Data: Array of 2 elements
[0]: Object
#text: string = 123MMain
@wd:Descriptor: string = Address Line 1
@wd:Type: string = ADDRESS_LINE_1
[1]: Object
#text: string = Suite 200
@wd:Descriptor: string = Address Line 2
@wd:Type: string = ADDRESS_LINE_2
wd:Location_Reference: Object
@wd:Descriptor: string = 123Main
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 846546543156
[1]: Object
@wd:type: string = Location_ID
#text: string = 10042
@wd:Effective_Date: string = 2004-03-12-08:00
wd:Pay_Rate_Type_Reference: Object
@wd:Descriptor: string = Salary
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 54564849849846548
[1]: Object
@wd:type: string = Pay_Rate_Type_ID
#text: string = Salary
wd:Job_Profile_Summary_Data: Object
wd:Job_Profile_Reference: Object
@wd:Descriptor: string = 123456 - IT Manager
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 45645464846545
[1]: Object
@wd:type: string = Job_Profile_ID
#text: string = 123456
wd:Job_Profile_Name: string = IT Manager
wd:Work_Shift_Required: string = 0
wd:Management_Level_Reference: Object
@wd:Descriptor: string = 11 Individual Contributor
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 564654a8964da6884f
[1]: Object
@wd:type: string = Management_Level_ID
#text: string = Individual Contributor
wd:Critical_Job: string = 0
wd:Job_Category_Reference: Object
@wd:Descriptor: string = Non-Officer
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 65464564ads65f4da
[1]: Object
@wd:type: string = Job_Category_ID
#text: string = Non-Officer
wd:Job_Exempt: string = 1
wd:Job_Family_Reference: Array of 2 elements
[0]: Object
@wd:Descriptor: string = Corporate
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 645651adf3545adf
[1]: Object
@wd:type: string = Job_Family_ID
#text: string = zz_Corporate
[1]: Object
@wd:Descriptor: string = Accounting & Finance
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 54d65asf41adf32a5d
[1]: Object
@wd:type: string = Job_Family_ID
#text: string = Accounting & Finance
wd:Worker_Type_Reference: Object
@wd:Descriptor: string = Regular
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 5321ads65f14d5a61fda654adsf
[1]: Object
@wd:type: string = Employee_Type_ID
#text: string = Regular
wd:Scheduled_Weekly_Hours: string = 40
wd:Start_Date: string = 2004-03-12-08:00
wd:Business_Title: string = It Manager
wd:Position_ID: string = P007376
wd:Exclude_from_Headcount: string = 0
wd:Full_Time_Equivalent_Percentage: string = 100
wd:Position_Reference: Object
@wd:Descriptor: string = P012345 IT Manager - Jane Doe (123456)
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 65123154643216846515
[1]: Object
@wd:type: string = Position_ID
#text: string = P012345
wd:Position_Title: string = Senior Investor Relations Specialist
wd:Job_Classification_Summary_Data: Object
wd:Job_Group_Reference: Object
@wd:Descriptor: string = EEO-1 Job Categories
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = 51465d16a155f1afda
[1]: Object
@wd:type: string = Job_Classification_Group_ID
#text: string = EEO_1
wd:Job_Classification_Reference: Object
@wd:Descriptor: string = 2 - Professionals (EEO-1 Job Categories-United States of America)
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = dafd61fads31fda65f1dsa3f1ads5f1d315
[1]: Object
@wd:type: string = Job_Classification_Reference_ID
#text: string = EEO_1_2
wd:Job_Exempt: string = 1
wd:Payroll_Interface_Processing_Data: Object
wd:Frequency_Reference: Object
@wd:Descriptor: string = Bi-weekly
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = da56f56daf1ad65f1ads65f1das56f4ad
[1]: Object
@wd:type: string = Frequency_ID
#text: string = Bi_weekly
wd:Default_Weekly_Hours: string = 40
wd:Position_Time_Type_Reference: Object
@wd:Descriptor: string = Full time
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = d4f5a6df56das4f65ads4f65sd4aaf65d
[1]: Object
@wd:type: string = Position_Time_Type_ID
#text: string = Full_time
wd:International_Assignment_Summary_Data: Object
wd:Has_International_Assignment: string = 0
wd:Home_Country_Reference: Object
@wd:Descriptor: string = United States of America
wd:ID: Array of 4 elements
[0]: Object
@wd:type: string = WID
#text: string = a65dsf1dsa56f41sda56f1ads
[1]: Object
@wd:type: string = xxxx-xxxxxxx-xxxxx-xx
#text: string = US
[2]: Object
@wd:type: string = xxxx-xxxxxxx-xxxxx-xx
#text: string = USA
[3]: Object
@wd:type: string = xxxx-xxxxxxx-xxxxx-xx
#text: string = 840
wd:Worker_ID: string = 100003
wd:Worker_Reference: Object
@wd:Descriptor: string = Jane Doe (123456)
wd:ID: Array of 2 elements
[0]: Object
@wd:type: string = WID
#text: string = a5d6sf165dsf1a65dsf1ads
[1]: Object
@wd:type: string = Employee_ID
#text: string = 123456

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2014 04:05 PM
Hi Monroe,
Try something like the following. It basically branches its way down the response tree until it gets to the 'wd:Name_Detail_Data' object which contains properties for first, middle and last name etc. You may need to reformat the tabbing as the syntax highlighter has modified mine.
var obj = xmlHelp.toObject(); // get entire response as object
if(obj){
var env_body = obj['env:Body']; // get object in first tier
if(env_body){
var wd_get_workers_response = env_body['wd:Get_Workers_Response']; // get object from first tier
if(wd_get_workers_response){
var wd_response_data = wd_get_workers_response['wd:Response_Data'];
if(wd_response_data){
var wd_worker_arr = wd_response_data['wd:Worker'];
if(wd_worker_arr){
for(var i=0;i<wd_worker_arr.length;i++){ // this will loop for all instances of the "wd:Worker" element. You may need to modify this to check for non-array though as the structure for a single element would be different
var wd_worker = wd_worker_arr[i]; // get current worker element in array
if(wd_worker){
var worker_data = wd_worker['wd:Worker_Data'];
if(worker_data){
var wd_personal_data = worker_data['wd:Personal_Data'];
if(wd_personal_data){
var wd_name_data = wd_personal_data['wd:Name_Data'];
if(wd_name_data){
var wd_legal_name_data = wd_name_data['wd:Legal_Name_Data'];
if(wd_legal_name_data){
var wd_name_detail_data = wd_legal_name_data['wd:Name_Detail_Data'];
if(wd_name_detail_data){
// get string values from object
var first_name = wd_name_detail_data['wd:First_Name'];
var middle_name = wd_name_detail_data['wd:Middle_Name'];
var last_name = wd_name_detail_data['wd:Last_Name'];
}
}
}
}
}
}
}
}
}
}
}
}
Regards,
Jake
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2014 03:19 PM
Jake,
It worked! Thanks a lot for your help. I was really close but I think what discouraged me is the fact that those objects log to the script log as "undefined". So I assumed it wasn't working. Looks as if I just had to walk down to a value. Now I just have to figure out why my results are telling me 11 pages exist but I can only see the first page.
Thanks again Jake!