Display image for an item in PurchTable in AX 2012
In the PurchTable form create a new tab page image in the line details and whenever any line is created then corresponding image for that item should be displayed in the newly created tab page image.
1) First of all check whether any image is attached for an item or not ?
To attach an image for an item :
Goto production information management -> common -> released products ->
select any item and click on the product image button in the product tab -> document handling of item number form is opened.
click on new -> select type embedded it opens attach file window -> select the image -> click ok.
refresh the page -> image is added to the item.
2) PurchTable -> design -> add tabpage image under line details tab and add window control under it and name it as image.
3) In the form methods create a new method showImage as shown below.
public void showImage()
{
Image itemImage;
productImageRecId = InventTable::find(PurchLine.ItemId).RecId;
if(productImageRecId)
{
select ecoResProductImage where ecoResProductImage.RefRecId == productImageRecId
|| ecoResProductImage.RefRecord == productImageRecId;
containerImage = ecoResProductImage.ThumbnailSize;
itemImage = new Image();
itemImage.setData(containerImage);
Image.image(itemImage);
image.widthValue(itemImage.width());
image.heightValue(itemImage.height());
}
}
NOTE : image is the window form control whose auto declaration is set to yes.
4) PurchTable -> Datasource -> PurchLine -> Methods -> active
In this method call the form method as element.showImage();
Thats it , the image will be displayed on the purchTable form.
SimilarLink:
http://usamaganatra.blogspot.in/2011/08/using-custom-image-resource-in-dynamics.html
No comments:
Post a Comment