I took reference from below Ruslan post and implemented same and working as expected but sometimes, am facing an issue saying like "An error occurred during processing of the field ItemRequiresTerms: There is already an open DataReader associated with this Command which must be closed first."
How to show images inside selector lookup?
One Stock Item may have multiple images and we need only icon images. Below is the code.
public void InventoryItemRowSelecting(PXCache sender, PXRowSelectingEventArgs e)
{
var row = e.Row as InventoryItem;
if (row != null)
{
if (!string.IsNullOrEmpty(row.ImageUrl))
{
foreach (NoteDoc noteDoc in PXSelectReadonly<NoteDoc, Where<NoteDoc.noteID, Equal<Required<NoteDoc.noteID>>>>.Select(Base, row.NoteID)) // here i got error
{
foreach (UploadFile uploadFile in PXSelectReadonly<UploadFile, Where<UploadFile.fileID, Equal<Required<UploadFile.fileID>>>>.Select(Base, noteDoc.FileID))
{
if (uploadFile.Name.Contains("icon"))
{
row.ImageUrl =
ControlHelper.GetAttachedFileUrl(null, uploadFile.FileID.ToString());
break;
}
}
}
}
}
}