departureId is the field which has lookup value, I am new to this and not sure whether you need any more code on this. The js itself is a big code, i am not sure which exact code you require for this.
function OpenNewBooking() {
//debugger;
var serverurl = Xrm.Page.context.getClientUrl();
var query = "col_bookingSet?$select=col_bookingid2&$filter=col_bookingId eq guid'" + entityid + "'";
query = serverurl + "/xrmservices/2011/OrganizationData.svc/" + query;
var results;
$.ajax({
type: "GET",
contentType: "application/json; charset=utf-8",
datatype: "json",
async: false,
url: query,
beforeSend: function (XMLHttpRequest) {
XMLHttpRequest.setRequestHeader("Accept", "application/json");
},
success: function (data, textStatus, XmlHttpRequest) {
//debugger;
results = data.d.results;
var bookingId = results[0].col_bookingid2.Id;
Xrm.Utility.openEntityForm("col_booking", bookingId);
$("#mainCopyContent").show();
$("#confirmCopyContent").hide();
//closeWindow();
}
});
--------------
function fillDepartureDropdown() {
//debugger;
var args = window.getDialogArguments();
serverurl = args["serverurl"];
currentdepartureid = args["iden"];
entityid = args["entityid"];
_cancel = args["_cancel"];
var date = new Date();
var departureFetchXML = '<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" >' +
' <entity name="col_departure" >' +
' <attribute name="col_name" />' +
' <attribute name="col_departureid" />' +
' <attribute name="col_departurenumber" />' +
' <attribute name="col_startdate" />' +
' <attribute name="col_registered" />' +
' <attribute name="col_participantsallowed" />' +
' <order attribute="col_name" descending="false" />' +
' <filter type="and" >' +
' <condition attribute="col_startdate" operator="ge" value="' + date.getFullYear() + '-' + date.getMonth() + '-' + date.getDay() + '" />' +
' </filter>' +
' </entity>' +
'</fetch>';
var encodedFetchXML = encodeURIComponent(departureFetchXML);
var uri = "col_departures?fetchXml=" + encodedFetchXML;
SendHttpRequest(uri, null, 'GET', function (e) {
//debugger;
var data = JSON.parse(this.response)
if (this.status == 200) {
FillDepartureDropDown(data.value);
}
});
}
Kindly check and let me know if there could be something else you wanted to refer to.
Thanks