Reputation: 11
I am using web resource in CRM of Dynamics 365. Recently, such an error occurred, and I didn't know why it happened and I asked a question.
Error log content:
ReferenceError: $ is not defined
I'll attach the part where the error log appears.
function setSerialnoinfo(){
var serialno = Xrm.Page.data.entity.attributes.get("skr_serialno");
if(Xrm.Page.getAttribute("skr_serialno").getValue() != null){
var serialnoid = serialno.getValue()[0].id;
var query = "/skr_installationSet(guid'"+serialnoid+"')";
$.ajax({
type: "GET",
async : false,
contentType: "application/json; charset=utf-8",
datatype: "json",
url: "/XRMServices/2011/OrganizationData.svc"+query,
beforeSend: function (XMLHttpRequest) {
XMLHttpRequest.setRequestHeader("Accept", "application/json");
},
success: function(data, textStatus, XmlHttpRequest) {
var result = data.d;
var skr_productid = result.skr_product.Id;
var skr_productname = result.skr_product.Name;
var skr_productentity = result.skr_product.LogicalName;
if (!(skr_productid == null || skr_productid == "")){
Xrm.Page.data.entity.attributes.get("skr_product").setValue([{id: skr_productid, name: skr_productname, entityType: skr_productentity}]);
}
//var skr_salestype = result.skr_salestype.Value;
var skr_warrantytype = result.skr_warrantytype.Value;
if(skr_warrantytype == 1){
skr_warrantytype = 0;
}
Xrm.Page.data.entity.attributes.get("skr_servicefeetype").setValue(skr_warrantytype);
var skr_servicecontracttype = result.skr_servicecontracttype.Value;
Xrm.Page.data.entity.attributes.get("skr_servicecontracttype").setValue(skr_servicecontracttype);
var skr_modelid = result.skr_model.Id;
var skr_modelname = result.skr_model.Name;
var skr_modelentity = result.skr_model.LogicalName;
if (!(skr_modelid == null || skr_modelid == "")){
Xrm.Page.data.entity.attributes.get("skr_setname").setValue([{id: skr_modelid, name: skr_modelname, entityType: skr_modelentity}]);
setsetname();
setErrorModel();
}
Xrm.Page.getAttribute("skr_product").setSubmitMode("always");
Xrm.Page.getAttribute("skr_servicefeetype").setSubmitMode("always");
Xrm.Page.getAttribute("skr_setname").setSubmitMode("always");
Xrm.Page.getAttribute("skr_servicecontracttype").setSubmitMode("always");
Xrm.Page.getAttribute("skr_productseries").setSubmitMode("always");
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
var userlcid = Xrm.Page.context.getUserLcid();
if(userlcid == "1042"){
alert("오류가 발생 했습니다. 다시 시도해 주세요.");
}else if(userlcid == "1033"){
alert("Unknown Error: Try again.");
}
}
});
}
}
This is an error in testing with the user's new UI version before Microsoft's 10 update.
I also want to know if the grammar of web resource changes a little after the update.
Upvotes: 0
Views: 389
Reputation: 22836
You are using jQuery library in your web resource, somehow the link is broken or conflict happening.
jquery.js
or jquery.min.js
in your HTML. Check entity form before this function residing library being referred - this is unsupported for this very same broken behaviorjQuery.noConflict()
. Read moreXMLHttpRequest
for supported scope & most important Xrm.Page
is deprecated, pls start using the ExecutionContext.getFormContext
Upvotes: 2