Step 1: Enable the
portal entity list(Contact,Account,etc)
Go to Portal > Entity List. Create
a new Entity List for Case Entity.
Step2: Enable
Odata feed with entity type and views also in entity list
Step3: Now, To retrieve the data, Hit the URL in browser.
URL : Portal_URL/_odata
URL : Portal_URL/_odata/Entity_Set_Name
: To retrieve the
data
Here we can see the
<atom:title type=”text”>Cases</atom:title>
Step4: Upload
your JavaScript in your respective “entity form”.
Below script :
if
(window.jQuery) {
(function ($) {
$(document).ready(function () {
if (typeof (Page_Validators) ==
'undefined') return;
// Create new validator
var newValidator =
document.createElement('span');
newValidator.style.display =
"none";
newValidator.id = "titleValidator";
newValidator.controltovalidate =
"title";
newValidator.errormessage =
"<a href='#title_label'>This Case has been already
generated.</a>";
newValidator.validationGroup =
""; // Set this if you have set ValidationGroup on the form
newValidator.initialvalue =
"";
newValidator.evaluationfunction =
function () {
var count = GetCase();
if (count > 0 )
return false; // Return false mean apply validation.
else
return true; // Return true mean successful.
};
// Add the new validator to the page
validators array:
Page_Validators.push(newValidator);
// Wire-up the click event handler of
the validation summary link
$("a[href='#title_label']").on("click", function ()
{ scrollToAndFocus('title_label','title'); });
});
}(window.jQuery));
}
function
GetCase(){
var count = 0;
var title=$("#title").val();
$.ajax({
type: "GET",
contentType: "application/json;
charset=utf-8",
datatype: "json",
url: "~/_odata/Cases?$filter=title eq
'"+title+"'",
beforeSend: function(XMLHttpRequest) {
XMLHttpRequest.setRequestHeader("Accept",
"application/json");
},
async: false,
success: function(data, textStatus, xhr) {
count = data.value.length;
},
error: function(xhr, textStatus,
errorThrown) {
Xrm.Utility.alertDialog(textStatus +
" " + errorThrown);
}
});
return
count;
}
Step5: If
duplicate case is created then it will show you like “This
Case has been already generated.”
Please refer to below screenshot.
You made such an interesting piece to read, giving every subject enlightenment for us to gain knowledge. Thanks for sharing the such information with us to read this... Microsoft Dynamics CRM Credit Card Processing
ReplyDeleteThanks for all your valuable labor on this website. Gloria delights in getting into investigations and it’s obvious why. Most people hear all concerning the dynamic method you present powerful guidelines on this website and as well boost response from other individuals on the subject matter so our own daughter is truly studying a lot of things. Take pleasure in the remaining portion of the new year. You’re the one carrying out a splendid job. webflow agency
ReplyDeleteI'm truly enjoying the design and layout of your site. It's a very easy on the eyes which makes it much more pleasant for me to come here and visit more often. Did you hire out a designer to create your theme? Superb work! webflow designers
ReplyDeleteThanks for your comment. I will do it on my own design to create.
DeleteThanks for a very interesting blog. What else may I get that kind of info written in such a perfect approach? I’ve a undertaking that I am simply now operating on, and I have been at the look out for such info. Microsoft Dynamics 365 Business Central Credit Card Processing
ReplyDeleteThanks a ton for this apt explanation about how to fetch records in synchronous way. I was really struggling with async callbacks while returning true/false based on results. Wish you all the best! Keep writing such great articles! Thanks again!
ReplyDelete