When creating an incident, I'm trying to check the value of a field on the Account (customerid).
I am using odata and jquery which are both pre-loaded on the form.
I am getting an Ajax Call Error when the function gets to the red part below. I have no other detail about the error.
Anyone has an idea? I can't find the error in my code.
AlerteCompteSupportDesactive = function () {
var compte = window.Xrm.Page.getAttribute('customerid').getValue();
if (compte === null || compte[0] === null) {
return;
}
var compteid = compte[0].id;
if (compteid !== null) {
var url = "/AccoutSet(guid'" + compteid + "')/new_Supportdesactive";
var entity = $.odata.getOne(url);
if (typeof entity !== 'undefined' && entity !== null && typeof entity.new_Supportdesactive !== 'undefined' && entity.new_Supportdesactive == 1)
{
Xrm.Page.ui.setFormNotification("Attention. Le support est désactivé pour ce compte! ", "WARNING", "alertecompte")
}
}
};