How to pass list object with ajax request on Asp.net Mvc

Sample controller and action

 [HttpPost]
 public ActionResult UpdateEmployeePerformance(List<ObjectivesList> ObjectivesList, EmployeePerformance Performance)
 {
     return Json("Ok", JsonRequestBehavior.AllowGet);
 }

Sample Ajax request

$.ajax({
	url: "/Custom/UpdateEmployeePerformanceReview",
	type: "POST",
	data: JSON.stringify({ ObjectivesList: updateObjectivesList, EmployeePerformance  : Performance}),
	dataType: "json",
	async: false,
	contentType: "application/json; charset=utf-8",
	beforeSend: function (XMLHttpRequest) {
		XMLHttpRequest.setRequestHeader("Accept", "application/json");
	},
	success: function (data) {
		debugger
	},
	error: function (XMLHttpRequest, textStatus, errorThrown) {
		debugger;
	}
});

#ajax-list-parameters-request, #ajax-request, #asp-net-mvc, #jquery

How to add lookup filter on custom javascripts

This function bind to form onload “OnLoad”, after calling the “preFilterLookup” function. This method access to form control and add to “addPreSearch” events. In events calling the custom fetchxml functions.

 


function OnLoad() {
preFilterLookup();
}

function preFilterLookup() {
Xrm.Page.getControl("formcontrolelementid").addPreSearch(function () {
addLookupFilter();
});
}

function addLookupFilter() {
fetchXml = "<filter type='and'>"
fetchXml += "<condition attribute='logicalname' operator='eq' value='value' ></condition>";
fetchXml += "</filter>";
Xrm.Page.getControl("formcontrolelementid").addCustomFilter(fetchXml);
}

#custom-js, #lookup, #lookup-filter, #web-resource