Tuesday, 4 February 2014

Attach document on list page Ax 2012

Step 1. Go To table that you are using as list page datasource and create display method.
//BP Deviation Documented
display smmDocIconNum showDocHandIcon()
{
#macrolib.resource
;
if ((select firstonly docuRef where docuRef.RefCompanyId == this.DataAreaId && docuRef.RefTableId == this.TableId && docuRef.RefRecId == this.RecId).RecId)
{
return #RES_NODE_DOC;
}
return #RES_AM_NEW;
}
Step 2: Now go to list page form > Designs >Design  > Grid > New Control > Window >
Step 3: Set window control properties Like
width : 15
height : 15
VerticalSpacing : 0
Label : Documents
DataSource : Which is used by Form
DataMethod : showDocHandIcon
Step 4 : Go to WindowControl > Method > Override Method > MouseUp >
write the code
int mouseUp(int _x, int _y, int _button, boolean _ctrl, boolean _shift)
{
CustTable custTable; // use your table
int ret;
ret = super(_x, _y, _button, _ctrl, _shift);
PurchRFQCaseTableForm::openDocHandling(custTable, element);
return ret;
}

No comments:

Post a Comment