Update the fields values from one field to another field while click the menu item button in form AX2012 :
1) Create the class
2) Create menu item (Action) and add the created class for menu item.
3) Created menu item attached in form menu item button.
4) override the menu item button for refresh the data source.
Ex Code:
Class:
class PMCopyEquipmenttoCLR
{
}
public void CopyEquipmenttoCLR(Args _args)
{
PMSubJobLotLevelLines pmSubJobLotLevelLines, pmSubJobLotLevelLinesloc;
pmSubJobLotLevelLinesloc = _args.record();
update_recordset pmSubJobLotLevelLines
setting Additional4 = pmSubJobLotLevelLines.EquipmentNumber
where pmSubJobLotLevelLines.Selected == NoYes::Yes
&& pmSubJobLotLevelLines.SubJobId == pmSubJobLotLevelLinesloc.SubJobId
&& pmSubJobLotLevelLines.EquipmentNumber!= "";
}
public static void main(Args _args)
{
PMSubJobLotLevelLines pmSubJobLotLevelLines;
PMCopyEquipmenttoCLR pmCopyEquipmenttoCLR;
FormDataSource PMSubJobLotLevelLines_ds;
pmCopyEquipmenttoCLR = new PMCopyEquipmenttoCLR();
if (_args.record() && _args.record().TableId == tableNum(PMSubJobLotLevelLines))
{
pmSubJobLotLevelLines = _args.record();
PMSubJobLotLevelLines_ds = pmSubJobLotLevelLines.dataSource();
pmCopyEquipmenttoCLR.CopyEquipmenttoCLR(_args);
}
}
This is the class for menu item button clicked for update the fields from one to another column.
1) Create the class
2) Create menu item (Action) and add the created class for menu item.
3) Created menu item attached in form menu item button.
4) override the menu item button for refresh the data source.
Ex Code:
Class:
class PMCopyEquipmenttoCLR
{
}
public void CopyEquipmenttoCLR(Args _args)
{
PMSubJobLotLevelLines pmSubJobLotLevelLines, pmSubJobLotLevelLinesloc;
pmSubJobLotLevelLinesloc = _args.record();
update_recordset pmSubJobLotLevelLines
setting Additional4 = pmSubJobLotLevelLines.EquipmentNumber
where pmSubJobLotLevelLines.Selected == NoYes::Yes
&& pmSubJobLotLevelLines.SubJobId == pmSubJobLotLevelLinesloc.SubJobId
&& pmSubJobLotLevelLines.EquipmentNumber!= "";
}
public static void main(Args _args)
{
PMSubJobLotLevelLines pmSubJobLotLevelLines;
PMCopyEquipmenttoCLR pmCopyEquipmenttoCLR;
FormDataSource PMSubJobLotLevelLines_ds;
pmCopyEquipmenttoCLR = new PMCopyEquipmenttoCLR();
if (_args.record() && _args.record().TableId == tableNum(PMSubJobLotLevelLines))
{
pmSubJobLotLevelLines = _args.record();
PMSubJobLotLevelLines_ds = pmSubJobLotLevelLines.dataSource();
pmCopyEquipmenttoCLR.CopyEquipmenttoCLR(_args);
}
}
This is the class for menu item button clicked for update the fields from one to another column.
No comments:
Post a Comment