I'm trying to query the Opportunity set, and I have a custom lookup field on the opportunity form that I'm trying to get the value of (either the guid or the name - preferably the name). However, I'm having trouble writing the expand part of it, as I haven't used that command before. Here's what I have so far:
var ODATA_EntityCollection = "/OpportunitySet";
var urlQuery = serverUrl + ODATA_ENDPOINT + ODATA_EntityCollection;
urlQuery += "?$select=new_Type,new_Date,new_Category,OpportunityId,new_opportunity_Agent&$expand=new_opportunity_Agent&$filter=CustomerId/Id eq (guid'" + contactId + "') and StatusCode/Value eq 1&$orderby=new_Date asc";
var req = new XMLHttpRequest();
req.open("GET", urlQuery, false);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.send(null);
var returned = eval('(' + req.responseText + ')').d;
var results = returned.results;
alert("This doesn't show up");
if (results == null || (results != null && results.length == 0))
return null;
return results;
It doesn't get to the alert. Any ideas?
This was working fine before I tried the expand.
Thanks.
*This post is locked for comments
I have the same question (0)