Hello community,
I have a case where based on a lookup value, I need to display an image. The code is working and logging values as expected but the image does not seem to load. When inspect HTML I find the following
[object Object]" title="">
and the error
https://dev2-is-il.creatio.com/0/Nui/[object%20Object] 404
However my method is returning the correct URL
https://dev2-is-il.creatio.com/0/conf/content/img/UsrRequests1Page-Dril…
Please find the code below
Diff
{
"operation": "insert",
"name": "UsrProjectCategoryCaption",
"values": {
"itemType": 6,
"layout": {
"colSpan": 24,
"rowSpan": 1,
"column": 0,
"row": 0
},
"visible": {
"bindTo": "IsPrjCatIconContVisible"
},
"caption": {
"bindTo": "Resources.Strings.ProjectCategoryCaption"
}
},
"parentName": "ProfileContainer",
"propertyName": "items",
"index": 0
},
{
"operation": "insert",
"name": "AccountPhotoContainer",
"values": {
"itemType": 7,
"wrapClass": [
"image-edit-container"
],
"items": [],
"layout": {
"colSpan": 24,
"rowSpan": 1,
"column": 0,
"row": 1
},
"visible": {
"bindTo": "IsPrjCatIconContVisible"
},
},
"parentName": "ProfileContainer",
"propertyName": "items",
"index": 1
},
{
"operation": "insert",
"name": "Photo",
"values": {
"layout": {
"colSpan": 24,
"rowSpan": 1,
"column": 0,
"row": 2
},
"getSrcMethod": "getPhotoSrcMethod",
"readonly": true,
/*"defaultImage": {
"bindTo": "getPhotoSrcMethod"
},*/
"generator": "ImageCustomGeneratorV2.generateCustomImageControl"
},
"parentName": "AccountPhotoContainer",
"propertyName": "items",
"index": 0
},
Methods
getPhotoSrcMethod:function()
{
var reqId=this.get("Id");
this.getProjectCategory(reqId, function(result) {
this.console.log("cbdone:" + result);
if(result.pjtCatId==="5f43b0aa-f7f6-4ffa-bc6d-15cf1fd581e0")
{
this.console.log("getIcon NationalPriorityImage");
this.set("Resources.Strings.ProjectCategoryCaption", result.pjtCatName);
this.set("IsPrjCatIconContVisible", true);
this.console.log("IsPrjCatIconContVisible true");
//class="ts-image-edit-full-size-element ts-image-style-rectangular"
return this.Terrasoft.ImageUrlBuilder.getUrl(this.get("Resources.Images.NationalPriorityImage"));
}
else if(result.pjtCatId==="08135814-ecdb-48ed-adea-5d4e5f1b0129")
{
this.console.log("getIcon BicyclePathsIcon");
this.set("Resources.Strings.ProjectCategoryCaption", result.pjtCatName);
this.set("IsPrjCatIconContVisible", true);
return this.Terrasoft.ImageUrlBuilder.getUrl(this.get("Resources.Images.BicyclePathsIcon"));
}
else if(result.pjtCatId==="a1a8e24d-6c6c-49ea-bb3c-5d76da662a27")
{
this.console.log("getIcon DrillingExplorationIcon");
this.set("Resources.Strings.ProjectCategoryCaption", result.pjtCatName);
this.set("IsPrjCatIconContVisible", true);
this.console.log(this.Terrasoft.ImageUrlBuilder.getUrl(this.get("Resources.Images.DrillingExplorationIcon")));
// return this.getSchemaImageUrl(this.get("Resources.Images.DrillingExplorationIcon"));
return this.Terrasoft.ImageUrlBuilder.getUrl(this.get("Resources.Images.DrillingExplorationIcon"));
}
else if(result.pjtCatId==="18588952-b4bf-4477-a614-a15a103adc28")
{
this.console.log("getIcon DrillimgAndNPIcon");
this.set("Resources.Strings.ProjectCategoryCaption", result.pjtCatName);
this.set("IsPrjCatIconContVisible", true);
return this.Terrasoft.ImageUrlBuilder.getUrl(this.get("Resources.Images.DrillingAndNPIcon"));
}
else
{
this.set("IsPrjCatIconContVisible", false);
this.console.log("IsPrjCatIconContVisible is false due to regular prj 2");
return this.Terrasoft.ImageUrlBuilder.getUrl(this.get("Resources.Images.AnalyticsDataIcon"));
}
},this);
},
getProjectCategory :function(reqId,callback,scope)
{
var result;
var esq = Ext.create("Terrasoft.EntitySchemaQuery", {
rootSchemaName: "UsrRequests"
});
esq.addColumn("Id");
esq.addColumn("UsrProject.UsrProjectCategory.Id","CatId");
esq.addColumn("UsrProject.UsrProjectCategory.Name","CatName");
esq.filters.add("ProjectFilter", Terrasoft.createColumnFilterWithParameter(
Terrasoft.ComparisonType.EQUAL, "Id",reqId));
esq.getEntityCollection(function(result) {
var resultValue = result.collection.collection.items;
var pjtCatId = resultValue[0].values.CatId;
var pjtCatName = resultValue[0].values.CatName;
this.console.log("pjtCatId:" + pjtCatId);
this.console.log("pjtCatName:" + pjtCatName);
result ={ success:true,
pjtCatId : pjtCatId,
pjtCatName:pjtCatName
};
callback.call(scope || this, result);
},this);
},