Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Saturday, May 24, 2014

Upload image in to form / Application photo in Dynamic Ax

Hi,

// Use this below code in clicked method for your button placed in form.
str filename;
FileNameFilter filter = ['JPG files','*.jpg'];
Bindata binData;
Image signatureImage = new Image();

super();

filename = Winapi::getOpenFileName(element.hWnd(), filter, '', "Upload your image", '', '');

binData = new BinData();

if (binData.loadFile(filename))
{
    signatureImage = binData.getData();
    WindowField.image(signatureImage); // WindowField - is the window field and make it auto declaration  : Yes
    WindowField.widthValue(signatureImage.width());
    WindowField.heightValue(signatureImage.height());
    element.resetSize();
    element.unLock();
}
Note:  this code stows the record but not stores the record in table.

Regards,

To get current User name in Dynamic AX

Hi,

print xUserInfo::find().id;
   
print xUserInfo::find().name;
   
pause;

Note: if it print ADMIN nothing to worry, because it printing your exact id only. this will be Admin when you,  working on domain project / project in domain instance this will print current user perfectly.

Regards,

Get a table ID in SQL - D365

Hi select ID from SysTableIdView where  SysTableIdView .Name = 'CustTable' Regards,