Hi,
We're currently moving from CRM4 to CRM2011/13. When I run the following code...
var queryOptions = {
entityName: "new_employment",
attributes: ["new_clientnameid"],
values: oCGuid,
columnSet: ["new_employerid", "new_startdate", "new_datefinished", "statuscode"],
orderby: ["new_employerid"]
};
var fetchedJobs = XrmServiceToolkit.Soap.QueryByAttribute(queryOptions);
if (fetchedJobs[0] != null) {
for (var i = 0; i < fetchedJobs.length; i++) {
// Get Employer GUID
var oEGuid = fetchedJobs[i].attributes["new_employerid"].value;
}
}
...the line
var oEGuid = fetchedJobs[i].attributes["new_employerid"].value
returns "undefined" and so results in an error later in the code.
The fetchedJobs.length returns 5 -this is correct (for the record I am accessing).
If I replace "new_employerid" with any other values from the columnSet then there is no problem at all, so the query appears to be working alright.
When the corresponding code is run in CRM4 on the same data, it works fine.
The field "new_employerid" is a lookup field on a form and stores the Employer GUID - though I understand that this is an array and wonder if that is why I am having this problem - though perhaps not.
Really am puzzled by this one and would appreciate it if anyone can shed any light on the issue.
Thanks in advance.
Doug.