Hi All,
I am having a problem using odata Query.
I am having a Custom entity with name "abc". Here i have two fields named CustomerId and Admission date. CustomerId is a lookup field from some other entity. Now in the "abc" entity i would like to add a new record, but before saving that record i would like to check whether any other record present with same combination of ClientId and Admission date. Here i used odata query for condition and SDK.Rest service for retrieving records. Below is the code:
var FieldObject = Xrm.Page.getAttribute("new_clientid");
var FieldValue = FieldObject.getValue();
var recordId = FieldValue[0].id;
if (recordId != null) {
var options = "select=new_name&$filter=new_ClientId/Id eq guid'" + recordId + "' and new_Admissiondate eq datetime'"+Admissiondate+''";
SDK.REST.retrieveMultipleRecords('new_admission', options, successCallbackResults, function (error) { alert(error.message); }, function () { }, true)
I am implementing this functionality on ONSave event. But the problem is i am unable to prevent the saving of record even if there is record present in the "abc". What functionality do i need to implement in successCallbackresults.
Any help is Appreciable