lunes, 23 de octubre de 2017

D365 - IMAGE ON A GRID (and list of symbols)



We will use an extended data type 'ImageReference' to reference the image. And we will build it as follows: 

1
2
3
ImageReference image;

image = imageReference::constructForSymbol(ImageReferenceSymbol::Accept);

'ImageReferenceSymbol:: ' Accepts many symbols. You can find a list of symbols on this link.

We will need to return the image in a container, constructing a packaging of the class:

1
2
3
4
Container imageContainer;

imageContainer = image.pack();
return imageContainer;

 Now we need to use a display method in the same way as in the previous entry [DISPLAY METHOD ON TABLE EXTENSION], we proceed as follows:


Create a new class that contains the display method, with the following source code :

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
public static class NewVendTrans_Extension
{
    [SysClientCacheDataMethodAttribute(true)]
    Public static display container displayTransMarkedByOtherSpecConciled(VendTrans _vendTrans)

    {
        vendTRansOpen       vendTransOpen;
        ImageReference      image;
        container           imageContainer;
       
        if(!vendTransOpen::findRefId(_vendTrans.recId).recId )
        {
            image          = ImageReference::constructForSymbol(ImageReferenceSymbol::Error);
            imageContainer = image.pack();
                
        }
        else
        {
            image = ImageReference::constructForSymbol(ImageReferenceSymbol::Assign);
            imageContainer = image.pack();
               
        }
        
        
        return  return imageContainer;
    }
}

Insert in the Grid an image type reference and assign the new generated display:


You can find a list of symbols on this link.

(Thanks Ivan for the images link). 

No hay comentarios:

Publicar un comentario